为什么TextBlob 0.3.7有时会生成小于-1的情感极性

时间:2013-08-08 23:39:26

标签: python python-2.7 sentiment-analysis textblob

我最近开始使用Python的TextBlob包(版本0.3.7)。根据文档,.sentiment方法返回一个情感极性和主观性元组,极性的定义范围在-1+1之间。

但是,此代码的极性值为-1.24

这是一个已知错误还是我对代码的使用有什么问题?

from text.blob import TextBlob
MyText = '''
tired of nbc universal. got 2 of the 3 periods of tonight's game and 62 of the 78 laps of the f1 race in monaco. stop the pregame crap and fill it with the event you morons!!!!!!
'''
text = TextBlob(MyText)
print text.sentiment

1 个答案:

答案 0 :(得分:0)

这是0.3.7中的已知错误。自版本0.3.7以来已有重大更新,包括改进的情绪分析,因此我将更新到最新版本(撰写本文时为0.5.2)。这可以通过

完成
pip install -U textblob