我正在测试 textblob 模块的正面和负面词。但有些结果并不好。例如 :
代码 :
from textblob.sentiments import NaiveBayesAnalyzer
from textblob import TextBlob
message = "Fraud"
blob = TextBlob(message, analyzer=NaiveBayesAnalyzer())
a = (blob.sentiment)
print(a)
结果
Sentiment(classification='pos', p_pos=0.6428571428571429, p_neg=0.3571428571428571)
它给出了 90% 的正确答案,但对于某些单词它返回错误的结果!!!
like : message = "like this" Sentiment(classification='neg', p_pos=0.4794333489299875, p_neg=0.5205666510700125)
message = "good habits"
Sentiment(classification='neg', p_pos=0.41318402216578204, p_neg=0.5868159778342183)
======================================
"fraud" = pos
"like this" = neg
"good habits" = neg