瀏覽代碼

Improve string sanitation for parsing

Ensure strings are properly sanitized before processing.
master
TheoryOfNekomata 10 月之前
父節點
當前提交
bb15edd726
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. +3
    -0
      packages/core/src/systems/en-US/parse.ts

+ 3
- 0
packages/core/src/systems/en-US/parse.ts 查看文件

@@ -33,6 +33,9 @@ const FINAL_TOKEN = '' as const;

export const tokenize = (stringValue: string) => (
stringValue
.toLowerCase()
.trim()
.replace(/\s+/, ' ')
.replace(new RegExp(`${TENS_ONES_SEPARATOR}`, 'g'), ' ')
.split(' ')
.filter((maybeToken) => maybeToken.length > 0)


Loading…
取消
儲存