【发布时间】:2019-02-04 08:15:28
【问题描述】:
我正在使用TextBlob 我在训练集上训练我的classifier,之后我成功地获得了分类输出
如果我在训练数据中放入情绪分数,我如何才能获得特定文本的正面或负面分数
这是我尝试过的
from textblob import TextBlob
from textblob.classifiers import NaiveBayesClassifier
train = [
('I love this sandwich.', 'pos'),
('This is an amazing place!', 'pos'),
('I feel very good about these beers.', 'pos'),
('I do not like this restaurant', 'neg'),
('I am tired of this stuff.', 'neg'),
("I can't deal with this", 'neg'),
("My boss is horrible.", "neg")
]
cl = NaiveBayesClassifier(train)
cl.classify("I feel amazing!")
这是输出
'pos'
我怎样才能得到这个像 pos .7 或任何其他格式的分数
【问题讨论】:
标签: python nltk sentiment-analysis textblob