【问题标题】:How can I get the stanford NLTK python module?如何获得 stanford NLTK python 模块?
【发布时间】:2013-11-10 17:25:48
【问题描述】:

我在 Ubuntu 13.10 中安装了 python (2.7.5) 和 python-nltk 软件包。运行apt-cache policy python-nltk 返回:

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

根据Stanford site,2.0+ 应该有stanford 模块。然而,当我尝试导入它时,我收到一个错误:

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

如何获得斯坦福模块? (最好通过通常的存储库,因为我不喜欢在 Ubuntu 包管理器之外安装软件。)

【问题讨论】:

  • 嗨!你看过这个其他相关的问题吗? stackoverflow.com/q/8555312/583834。另外,我刚刚在mac上创建了一个virtualenv,pip install nltkimport nltk.tag.stanford 在没有nltk.download() 的情况下工作。话虽如此,我不知道所需文件(即/usr/share/stanford-ner/classifiers/all.3class.distsim.crf.ser.gz/usr/share/stanford-ner/stanford-ner.jar)在哪里......

标签: python ubuntu nltk


【解决方案1】:

您需要使用 NLTK 下载器:

import nltk
nltk.download()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-29
    • 2016-02-18
    • 2023-03-10
    • 2015-03-12
    • 1970-01-01
    • 2015-06-17
    • 1970-01-01
    • 2014-05-13
    相关资源
    最近更新 更多