我注意到我无法从nltk.corpus.reader或nltk.corpus导入framenet,并且了解它在较新版本的NLTK中可用。
$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> nltk.__version__
'3.0a2'
但是nltk.downloader显示了framenet_v15的一个条目,在文件系统中我有一个目录framnet_v15。 那为什么我不能导入呢?
>>> from nltk.corpus import framenet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name framenet
>>> from nltk.corpus.reader import framenet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name framenet
如您所见:已经安装了framenet语料库
答案 0 :(得分:1)
示例强>
#!/usr/bin/env python
from nltk.corpus.reader import framenet
<强>安装强>
下载NLTK 3.0
tar -xzvf ntlk-3.0a3.tar.gz
cd nltk-3.0a3 /
sudo python setup.py install
<强>执行强>
./ example.py