使用 colab 时没有这样的文件或目录 'nltk_data/corpora/stopwords/English'
No such file or directory 'nltk_data/corpora/stopwords/English' when using colab
首先,我在工作中使用 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'
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')
首先,我在工作中使用 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'
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')