2
我是新來的情感分析。我想得到的積極分數只有不是所有像複合,負,pos,neutral.Can任何人都可以幫助我做到這一點?如何獲得積極分數?
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)
在此先感謝。
我是新來的情感分析。我想得到的積極分數只有不是所有像複合,負,pos,neutral.Can任何人都可以幫助我做到這一點?如何獲得積極分數?
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)
在此先感謝。
基礎上source code,該方法返回一個字典與形狀:
{"neg" : ..., "neu" : ..., "pos" : ..., "compound" : ...}
所以,你可以簡單地使用:
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)['pos'] # the positive score
這裏['pos']
獲取與該'pos'
關聯的值鍵。
@ Willem Van Onsem謝謝:) –