2017-03-07 5 views
2

私は感情分析に新しいです。私は肯定的なスコアだけを得たいと思っています。化合物、ネガ、ポジ、ニュートラルのようなものではありません。どのように肯定的な得点を得るには?

sid = SentimentIntensityAnalyzer() 
ss = sid.polarity_scores(sentence) 

ありがとうございます。

答えて

1

source codeに基づいて、この方法は、形状に辞書を返します。

{"neg" : ..., "neu" : ..., "pos" : ..., "compound" : ...} 

だから、あなたは、単に使用することができます。

sid = SentimentIntensityAnalyzer() 
ss = sid.polarity_scores(sentence)['pos'] # the positive score

ここ['pos']'pos'に関連付けられている値をフェッチキー。

+0

@ Willem Van Onsem thanks :) –

関連する問題