我试图在python 2.7中导入nltk包
import nltk
stopwords = nltk.corpus.stopwords.words('english')
print(stopwords[:10])
运行此命令会导致以下错误:
LookupError:
**********************************************************************
Resource 'corpora/stopwords' not found. Please use the NLTK
Downloader to obtain the resource: >>> nltk.download()
因此,我打开python终端并执行以下操作:
import nltk
nltk.download()
这给了我:
showing info https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
然而,这似乎并没有停止。再次运行它仍然会给我同样的错误。你有什么想法吗?
在命令行中,Kurt Bourbaki提到的一些:
您目前正在尝试下载nltk数据中的每个项目,因此这可能需要很长时间。您可以尝试仅下载所需的停止字:
或者从命令行(感谢Rafael Valero's answer):
参考:
您可以在控制台中单独执行此操作。
它会给你一个结果。
当我面对这个问题时,我使用了jupyter控制台。
相关问题 更多 >
编程相关推荐