首先,我在工作中使用 Google colab,并且 我已经下载了英语的 nltk 停用词,内容如下:
nltk.download('stopwords')
下载成功
[nltk_data] Downloading package stopwords to /root/nltk_data...
但是当我运行 stop = stopwords.words('English')
我收到 OSError: No such file or directory: '/root/nltk_data/corpora/stopwords/English'
最佳答案
长话短说
English
应该是小写 =)
参见:https://colab.research.google.com/drive/1tNt0Ifom-h4OnFBBZpLndYCEPDU598jE
在代码中
# Downloads the data.
import nltk
nltk.download('stopwords')
# Using the stopwords.
from nltk.corpus import stopwords
# Initialize the stopwords
stoplist = stopwords.words('english')
关于python - 使用 colab 时没有这样的文件或目录 'nltk_data/corpora/stopwords/English',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53772907/