我是情绪分析的新手。我只想得到积极的分数,而不是像复合,否定,pos,中性。谁能帮我实现这个目标?
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)
提前致谢。
我是情绪分析的新手。我只想得到积极的分数,而不是像复合,否定,pos,中性。谁能帮我实现这个目标?
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)
提前致谢。
Based on the source code, the method returns a dictionary with shape:
{"neg" : ..., "neu" : ..., "pos" : ..., "compound" : ...}
So you can simply use:
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)['pos'] # the positive score
Here ['pos']
fetches the value that is associated with the 'pos'
key.