TextBlob 是否有任何功能可以获得中性分类?
Is there any feature of TextBlob to obtain neutral classification?
我对使用 textBlob 构建文本分类器很感兴趣,但从我的研究来看,在将分类器训练为 return 中性标签后看起来并不像。有谁知道实现这个的方法吗?或者是否有提供中性分类的类似库?谢谢。
我正在为此使用 If else 语句:
喜欢
from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
blob = TextBlob(message, analyzer=NaiveBayesAnalyzer())
a = (blob.sentiment)
if a.__getattribute__("p_pos") > a.__getattribute__("p_neg"):
tag = str(a.__getattribute__("classification"))
sentiment = str(a.__getattribute__("p_pos"))
elif a.__getattribute__("p_pos") < a.__getattribute__("p_neg"):
tag = str(a.__getattribute__("classification"))
sentiment = str(a.__getattribute__("p_neg"))
else:
tag = "N"
sentiment = "0"
如果他们是中性句,p_pos和p_neg将相等!
这对我有用!!!
希望对你有用
我对使用 textBlob 构建文本分类器很感兴趣,但从我的研究来看,在将分类器训练为 return 中性标签后看起来并不像。有谁知道实现这个的方法吗?或者是否有提供中性分类的类似库?谢谢。
我正在为此使用 If else 语句: 喜欢
from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
blob = TextBlob(message, analyzer=NaiveBayesAnalyzer())
a = (blob.sentiment)
if a.__getattribute__("p_pos") > a.__getattribute__("p_neg"):
tag = str(a.__getattribute__("classification"))
sentiment = str(a.__getattribute__("p_pos"))
elif a.__getattribute__("p_pos") < a.__getattribute__("p_neg"):
tag = str(a.__getattribute__("classification"))
sentiment = str(a.__getattribute__("p_neg"))
else:
tag = "N"
sentiment = "0"
如果他们是中性句,p_pos和p_neg将相等!
这对我有用!!! 希望对你有用