首先,我使用 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')
人们将来会看到此错误,请在安装 NLTK 库后运行此命令行 pip install --升级nltk 它对我有用