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

标签 python nlp nltk google-colaboratory

首先,我在工作中使用 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/

相关文章:

python - 在 Python 脚本中抑制 pjsua 输出

python - 如何在 Keras 中保存每个时期的预测数据

python - 尝试在 Python 中运行 truecase 时收到 "UnpicklingError: Invalid load key, ' v'."

python - 短文本主题建模 Python

machine-learning - 如何解读scikit的learn混淆矩阵和分类报告?

python - 如何使用nltk从字符串中提取名称

python - macOS Sierra 上的 nltk

Python 制表

python - Django 条件创建

architecture - Apache Open NLP 与 NLTK