How can I get the stanford NLTK python module?

北城余情 提交于 2020-01-03 18:57:06

问题


I have the python (2.7.5) and python-nltk packages installed in Ubuntu 13.10. Running apt-cache policy python-nltk returns:

python-nltk:
  Installed: 2.0~b9-0ubuntu4

And according to the Stanford site, 2.0+ should have the stanford module. Yet when I try to import it, I get an error:

>>> import nltk.tag.stanford
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named stanford

How can I get the stanford module? (Preferably through the usual repositories, since I don't like to install software outside the Ubuntu package manager.)


回答1:


You need to use NLTK downloader:

import nltk
nltk.download()


来源:https://stackoverflow.com/questions/19694106/how-can-i-get-the-stanford-nltk-python-module

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!