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

Function segmentLookupVariants

src/search/identifier-segments.ts:147–160  ·  view source on GitHub ↗
(word: string)

Source from the content-addressed store, hash-verified

145 * that used to mint "class" → clas.
146 */
147export function segmentLookupVariants(word: string): string[] {
148 const variants = [word];
149 const canStrip2 = word.length >= MIN_PROSE_CHARS + 2;
150 const canStrip1 = word.length >= MIN_PROSE_CHARS + 1;
151 if (/(?:x|sh|ss|zz)es$/.test(word)) {
152 if (canStrip2) variants.push(word.slice(0, -2));
153 } else if (/(?:ch|s|z|o)es$/.test(word)) {
154 if (canStrip2) variants.push(word.slice(0, -2));
155 if (canStrip1) variants.push(word.slice(0, -1));
156 } else if (word.endsWith('s') && !word.endsWith('ss')) {
157 if (canStrip1) variants.push(word.slice(0, -1));
158 }
159 return variants;
160}

Callers 2

getSegmentMatchesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected