【发布时间】:2017-12-15 05:19:44
【问题描述】:
我在 Python 中使用 stop_words 包。目录路径usr/local/lib/python2.7/dist-packages/stop_words/stop-words 中的english.txt 文件中的停用词的原始数量是174,我又添加了几个,列表变成了218。
我使用以下命令来获取停用词
from stop_words import get_stop_words
en_stop = get_stop_words('en')
len(en_stop) 仍然显示174。请你能告诉我如何使更改反映出来吗?
【问题讨论】:
-
不确定,但您不应该像那样修改系统文件。它们将在升级期间被覆盖。相反,使用
get_stop_words从原始包中获取库存列表,然后将您自己的添加到其中。 -
@Thomas 我有很多停用词要添加,我希望它们永久地被规范为停用词。该列表没有一些非常常见的词,例如“虽然”和“尽管”。
标签: python python-2.7 stop-words