trinker / sentimentr

Dictionary based sentiment analysis that considers valence shifters
Other
427 stars 84 forks source link

Emotion function returns inconsistent results #108

Closed IgorCersosimo closed 3 years ago

IgorCersosimo commented 5 years ago

The "emotion" function is returning inconsistent results.

Example 1: emotion("I lie")

The result should be a score 1 for "anger", "disgust" and "sadness". The function, instead, returns score 3 for such emotions.

Looking at the code, the problem seems to be the result of an incorrect "merge" operation on the temporary variable "out".

Notice that the problem disappears when analyzing multiple sentences in a vector, if at least one of the sentences contains a negated emotion.

Example 2: emotion(c("I don't love", "I lie")) The score for the second sentence is correct.

Example 3: emotion(c("I love", "I lie")) The score for the second sentence is different from the example above and incorrect.

trinker commented 3 years ago

Thank you for bringing this to my attention. I'll look into it.

trinker commented 3 years ago

Thanks again. This has been addressed.

IgorCersosimo commented 3 years ago

Glad I could help!