我是python的新手,正在尝试使用vaderthiotation库进行情绪分析。你知道吗
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyser = SentimentIntensityAnalyzer()
def print_sentiment_scores(sentence):
snt = analyser.polarity_scores(sentence)
print("{:-<40} {}".format(sentence, str(snt)))
print_sentiment_scores("I just got a call from my boss - does he realise it's Saturday?")
我刚接到老板的电话-他知道今天是星期六吗?{'neg':0.0,'neu':1.0,'pos':0.0,'compound':0.0}
如你所见,应用程序运行,但只有当我手动输入文本。我如何使它读取一个ms word文件的文本,甚至csv文件给我的所有文本在该文件中的最终情感分数?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐