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

Function segmentLookupVariants

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

Source from the content-addressed store, hash-verified

172 * that used to mint "class" → clas.
173 */
174export function segmentLookupVariants(word: string): string[] {
175 const variants = [word];
176 const canStrip2 = word.length >= MIN_PROSE_CHARS + 2;
177 const canStrip1 = word.length >= MIN_PROSE_CHARS + 1;
178 if (/(?:x|sh|ss|zz)es$/.test(word)) {
179 if (canStrip2) variants.push(word.slice(0, -2));
180 } else if (/(?:ch|s|z|o)es$/.test(word)) {
181 if (canStrip2) variants.push(word.slice(0, -2));
182 if (canStrip1) variants.push(word.slice(0, -1));
183 } else if (word.endsWith('s') && !word.endsWith('ss')) {
184 if (canStrip1) variants.push(word.slice(0, -1));
185 }
186 return variants;
187}

Callers 2

getSegmentMatchesMethod · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected