我最近开始使用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
答案 0 :(得分:0)
这是0.3.7中的已知错误。自版本0.3.7以来已有重大更新,包括改进的情绪分析,因此我将更新到最新版本(撰写本文时为0.5.2)。这可以通过
完成pip install -U textblob