MCPcopy
hub / github.com/CaviraOSS/OpenMemory / tokenize

Function tokenize

backend/src/utils/text.ts:37–44  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

35const tok_pat = /[a-z0-9]+/gi;
36
37export const tokenize = (text: string): string[] => {
38 const toks: string[] = [];
39 let m: RegExpExecArray | null;
40 while ((m = tok_pat.exec(text))) {
41 toks.push(m[0].toLowerCase());
42 }
43 return toks;
44};
45
46const stem = (tok: string): string => {
47 if (tok.length <= 3) return tok;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected