Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentiment Analysis Confidence Scores #52

Open
shawnbeaulieu opened this issue May 1, 2017 · 4 comments
Open

Sentiment Analysis Confidence Scores #52

shawnbeaulieu opened this issue May 1, 2017 · 4 comments

Comments

@shawnbeaulieu
Copy link

Hello,

For sentiment analysis I'm able to obtain the score that corresponds to the class with the highest estimated probability, but I'm unable to produce the estimations themselves (e.g. [very_negative = 0.60, negative = 0.25, neutral = 0.10, positive = 0.025, very_positive = 0.025]). I'd like to filter probabilities below a certain confidence threshold.

Thank you.

@vacous
Copy link

vacous commented Apr 29, 2018

Hi, I had the same question but I think I figured it out
with the setting:
nlp = StanfordCoreNLP('http://localhost:9000')
res = nlp.annotate(some_sentence, properties={ 'annotators': 'sentiment', 'outputFormat': 'json', 'timeout': 1000, })
The result: res is structured in the way:
res['sentence'] = [result_first_sentence, result_second_sentnce, ..., result_last_sentence]
and you can look into the result for each sentence, the result is output in a dict format with keys

['index',
 'parse',
 'basicDependencies',
 'enhancedDependencies',
 'enhancedPlusPlusDependencies',
 'sentimentValue',
 'sentiment',
 'sentimentDistribution',
 'sentimentTree',
 'tokens']

And the 'sentimentDistribution' should be the one you are looking for
so if you are interested in the sentiment distribution of the first sentence, then:
res['sentences'][0]['sentimentDistribution']

@AlexFine
Copy link

@vacous What does the sentimentDistribution represent? I receive an array of five numbers? Do you know what those five numbers mean?

@vacous
Copy link

vacous commented Aug 28, 2018

@AlexFine it represents the probabilities for "--(very negative)", "-", "0", "+", "++" sentiment in the sentence.
Please see https://nlp.stanford.edu/sentiment/ for more details.

@AlexFine
Copy link

@vacous thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants