MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / boostScoresByExternalCalls

Function boostScoresByExternalCalls

packages/code-map/src/parse.ts:319–330  ·  view source on GitHub ↗
(
  tokenScores: Record<string, Record<string, number>>,
  externalCalls: Record<string, number>,
)

Source from the content-addressed store, hash-verified

317}
318
319function boostScoresByExternalCalls(
320 tokenScores: Record<string, Record<string, number>>,
321 externalCalls: Record<string, number>,
322): void {
323 for (const scores of Object.values(tokenScores)) {
324 for (const token of Object.keys(scores)) {
325 const numCalls = externalCalls[token] ?? 0
326 scores[token] *= 1 + Math.log(1 + numCalls)
327 scores[token] = Math.round(scores[token] * 1000) / 1000
328 }
329 }
330}
331
332function emptyParsedTokens(skipped: boolean): ParsedTokensForScoring {
333 return {

Callers 1

getFileTokenScoresFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected