【问题标题】:Import Error, When I import nltk.corpus.framenet in NLTK Python导入错误,当我在 NLTK Python 中导入 nltk.corpus.framenet
【发布时间】:2013-12-05 14:22:00
【问题描述】:

我必须在 nltk.corpus 中使用框架网。因此,我使用 nltk.download() 下载了该语料库。而framenet目录现在是C:\nltk_data\corpora\framenet_v15...

但是当我导入那个框架网时,我不能。我找不到原因。 我想要这里解释的一些作品; http://nltk.org/howto/framenet.html

>>> import nltk.corpus.framenet

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import nltk.corpus.framenet
ImportError: No module named framenet

请帮帮我。谢谢。

【问题讨论】:

  • 我认为 framenet 支持 nltk v3 及更高版本,但我可能错了,你有什么 nltk 版本?
  • 我的 nltk 版本是 '2.0.4'...也许你是对的。我马上试试..
  • 看这个:nltk.org/install.html
  • 谢谢!!!我解决了问题!!现在没有错误! :))

标签: python nltk


【解决方案1】:

在你的链接中它是这样导入的:

from nltk.corpus import framenet

你试过了吗?

编辑:NLTK 3.0 及以上版本在nltk.corpus.reader 包中有框架网,所以它应该是:

from nltk.corpus.reader import framenet

【讨论】:

  • 当然,我做到了。这就是我得到的。 >>> from nltk.corpus import framenet Traceback(最近一次调用最后):文件“”,第 1 行,在 from nltk.corpus import framenet ImportError: cannot import name framenet
  • 不幸的是......我遇到了同样的错误。 >>> from nltk.corpus.reader import framenet Traceback(最近一次调用最后):文件“”,第 1 行,在 from nltk.corpus.reader import framenet ImportError: cannot import name framenet
  • 你有什么版本?最新版本的 NLTK 在 nltk.corpus.reader 包中有框架网:nltk.org/api/…
  • 谢谢。问题是 nltk 的版本。它是 2.0.4 版本。再次感谢!
猜你喜欢
  • 1970-01-01
  • 2016-07-07
  • 1970-01-01
  • 1970-01-01
  • 2013-05-17
  • 2020-07-28
  • 2011-10-03
  • 1970-01-01
  • 2023-04-07
相关资源
最近更新 更多