0
我有兴趣使用textBlob构建文本分类器,但是从训练分类器返回中性标签后,我的研究看起来不像。有没有人知道一种方法来实现这一点?还是有类似的图书馆提供中性分类?谢谢。TextBlob有没有获得中性分类的功能?
我有兴趣使用textBlob构建文本分类器,但是从训练分类器返回中性标签后,我的研究看起来不像。有没有人知道一种方法来实现这一点?还是有类似的图书馆提供中性分类?谢谢。TextBlob有没有获得中性分类的功能?
我使用如果此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将等于!
这适用于我! 希望它适合你