我没有做正确的事情 - 通过错误的外观我越来越我认为我错过了一些数据。我已经为sentiment_classifier(https://pypi.python.org/pypi/sentiment_classifier/0.7)安装了所有先决条件,它们分别是nltk,numpy和sentiwordnet。这里是我的代码 - 来自我想要工作的文档的一个简单示例。使用senti_classifier和NLTK的情绪分析
from senti_classifier import senti_classifier
sentences = ['The movie was the worst movie', 'It was the worst acting by the actors']
pos_score, neg_score = senti_classifier.polarity_scores(sentences)
print pos_score, neg_score
和这里的错误消息我得到
Traceback (most recent call last):
File "/home/beef/sciencefair2017/sentiment.py", line 1, in <module>
from senti_classifier import senti_classifier
File "build/bdist.linux-x86_64/egg/senti_classifier/senti_classifier.py", line 227, in <module>
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1178, in resource_stream
self, resource_name
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1454, in get_resource_stream
return io.BytesIO(self.get_resource_string(manager, resource_name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1457, in get_resource_string
return self._get(self._fn(self.module_path, resource_name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1535, in _get
return self.loader.get_data(path)
IOError: [Errno 0] Error: 'senti_classifier/data/SentiWn.p'
有什么问题,以及如何我可以得到它的工作?任何建议,即使只是一个建议,而不是一个实际的解决方案,不胜感激。我已经尝试过所有软件包的各种版本,并且我浏览过一些文档无济于事。现在经过精心
git clone https://github.com/kevincobain2000/sentiment_classifier
cd sentiment_classifier
python setup.py install
作品 - :
我不认为可能是这个问题,但是你可以尝试在actor的'由演员'删除额外的空间(“by”和“the”之间的一个空格)吗? – fedepad
@fedepad只是编辑它 - 惊讶我没有注意到它自己!那东西通常真的让我感到困扰。 –
我会写一个答案,如果它的工作......但我不知道这是问题所在。我正在查看库中的代码以查看该代码。让我知道。 – fedepad