浏览代码

Removing invisible chars before tokenization. (#4233)

### What problem does this PR solve?

#4223

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/nightly
Kevin Hu 10 个月前
父节点
当前提交
7e063283ba
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1
    0
      rag/nlp/rag_tokenizer.py

+ 1
- 0
rag/nlp/rag_tokenizer.py 查看文件

@@ -264,6 +264,7 @@ class RagTokenizer:
return [self.stemmer.stem(self.lemmatizer.lemmatize(t)) if re.match(r"[a-zA-Z_-]+$", t) else t for t in tks]

def tokenize(self, line):
line = re.sub(r"\W+", " ", line)
line = self._strQ2B(line).lower()
line = self._tradi2simp(line)
zh_num = len([1 for c in line if is_chinese(c)])

正在加载...
取消
保存