使用colab时,没有这样的文件或目录'nltk_data / corpora / stopwords / English'

joh*_*ohn 3 python nlp nltk google-colaboratory

首先,我正在使用Google colab进行工作,并且我已经下载了英文的nltk停用词,其中包含以下内容:

nltk.download('stopwords')
Run Code Online (Sandbox Code Playgroud)

下载成功

[nltk_data] Downloading package stopwords to /root/nltk_data...
Run Code Online (Sandbox Code Playgroud)

但是当我跑步时 stop = stopwords.words('English')

我正进入(状态 OSError: No such file or directory: '/root/nltk_data/corpora/stopwords/English'

alv*_*vas 7

TL; DR

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')
Run Code Online (Sandbox Code Playgroud)