为什么 gensim 的 simple_preprocess Python 标记器似乎跳过了“i”标记?

987*_*xkj 1 python nlp tokenize gensim

list(gensim.utils.simple_preprocess("i you he she I it we you they", deacc=True))
Run Code Online (Sandbox Code Playgroud)

结果如下:

['you', 'he', 'she', 'it', 'we', 'you', 'they']
Run Code Online (Sandbox Code Playgroud)

正常吗?有没有跳过的单词?我应该使用另一个标记器吗?

额外问题:“deacc=True”参数是什么意思?

goj*_*omo 6

正如@user2357112-supports-monica 在他们的评论中提到的,这是 设计行为的一部分simple_preprocess(),根据其文档,丢弃任何短于min_len=2字符的标记。

您的“奖金问题”也在同一文档中得到解答:

  • deacc (bool, optional) – 使用deaccent()从标记中删除重音符号?

(该deaccent()函数是另一个实用程序函数,记录在链接中,它完全符合名称和文档的建议:从字母中删除重音符号,例如,'é'变为'e'.)