pythonnltk情感分析器_使用sendi_classifier和NLTK的情感分析

博主在尝试使用 sentiment_classifier 库进行情感分析时遇到了导入错误。错误信息显示在访问 'senti_classifier/data/SentiWn.p' 文件时发生了 IOError。这可能是由于库的资源文件未正确安装或路径问题导致的。博主已经尝试了不同版本的库和相关软件包,但问题仍未解决,寻求帮助以找到解决方案。
摘要由CSDN通过智能技术生成

我没有做正确的事-从错误的外观来看,我认为我正在丢失一些数据.我已经为ntk,numpy和sentiwordnet安装了sentiment_classifier(https://pypi.python.org/pypi/sentiment_classifier/0.7)的所有先决条件.这是我的代码-我正在尝试工作的文档中的一个简单示例.

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

from senti_classifier import senti_classifier

File "build/bdist.linux-x86_64/egg/senti_classifier/senti_classifier.py", line 227, in

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'

有什么问题,我该如何运作?任何建议,即使只是建议而不是实际解决方案,都将受到极大的赞赏.我已经尝试过所有软件包的各种版本,并且通过一些文档都没有用.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值