MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / getSegmentNameCounts

Method getSegmentNameCounts

src/db/queries.ts:735–745  ·  view source on GitHub ↗

How many distinct names each segment appears in — the rarity signal that * separates a discriminative word ("checkout") from a ubiquitous one ("state").

(segments: string[])

Source from the content-addressed store, hash-verified

733 /** How many distinct names each segment appears in — the rarity signal that
734 * separates a discriminative word ("checkout") from a ubiquitous one ("state"). */
735 getSegmentNameCounts(segments: string[]): Map<string, number> {
736 if (segments.length === 0) return new Map();
737 const placeholders = segments.map(() => '?').join(', ');
738 const rows = this.db
739 .prepare(
740 `SELECT segment, COUNT(*) AS n FROM name_segment_vocab
741 WHERE segment IN (${placeholders}) GROUP BY segment`,
742 )
743 .all(...segments) as Array<{ segment: string; n: number }>;
744 return new Map(rows.map((r) => [r.segment, r.n]));
745 }
746
747 /** Names containing the given segment (rare-single-word tier). */
748 getNamesForSegment(segment: string, limit: number): string[] {

Callers 1

getSegmentMatchesMethod · 0.80

Calls 3

allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected