Python情感分类

2024-06-02 08:58:44 发布

您现在位置:Python中文网/ 问答频道 /正文

嗨,我正在尝试使用情感分类器对某些文本文件进行分类包。那个以下程序适用于单个句子,即:

from senti_classifier import senti_classifier
sentences = ['i love u']
pos_score, neg_score = senti_classifier.polarity_scores(sentences)
print pos_score, neg_score

但是,当使用xls文件对每一条记录进行分类时,正、负分的结果都是0.0。 请帮帮我。在

^{pr2}$

Tags: fromposimport程序分类器分类sentences句子
1条回答
网友
1楼 · 发布于 2024-06-02 08:58:44

^{} function需要一个字符串列表作为参数,但您传递的是单个字符串。把它放到列表中:

pos_score, neg_score = senti_classifier.polarity_scores([sentences])

相关问题 更多 >