MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / isValidWord

Function isValidWord

packages/core/src/nlp/text-utils.ts:124–136  ·  view source on GitHub ↗
(
  word: string,
  locale: string,
  minLength: number,
  enableStopwords: boolean,
  isStopwordFn: (word: string, locale: string) => boolean
)

Source from the content-addressed store, hash-verified

122 * 判断是否为有效词语
123 */
124export function isValidWord(
125 word: string,
126 locale: string,
127 minLength: number,
128 enableStopwords: boolean,
129 isStopwordFn: (word: string, locale: string) => boolean
130): boolean {
131 if (!word || word.trim().length === 0) return false
132 if (PURE_NUMBER_REGEX.test(word)) return false
133 if (word.length < minLength) return false
134 if (enableStopwords && isStopwordFn(word, locale)) return false
135 return true
136}

Callers 3

segmentFunction · 0.90
collectPosTagStatsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected