MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / stem

Function stem

src/context/approach-recall.ts:19–29  ·  view source on GitHub ↗
(word: string)

Source from the content-addressed store, hash-verified

17 */
18const SUFFIXES = ['ation', 'ising', 'izing', 'ings', 'ing', 'ers', 'ies', 'er', 'ed', 'es', 'ate', 'ly', 's'];
19export function stem(word: string): string {
20 if (word.length <= 4) return word;
21 for (const suf of SUFFIXES) {
22 if (word.endsWith(suf) && word.length - suf.length >= 3) {
23 let root = word.slice(0, word.length - suf.length);
24 if (suf === 'ies') root += 'y'; // categories → category
25 return root;
26 }
27 }
28 return word;
29}
30
31/** Tokenize + stem — the recall ranker's semantic-lexical vocabulary. PURE. */
32export function semanticTokens(text: string): string[] {

Callers 2

surfaceByStemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected