Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using WordNet-Affect with NLTK [duplicate]

I downloaded WN-Affect. I am however not sure how to use it to detect the mood of a sentence. For example if I have a string "I hate football." I want to be able to detect whether the mood is bad and the emotion is fear. WN-Affect has no tutorial on how to do it, and I am kind of new to python. Any help would be great!

like image 264
user3078335 Avatar asked Nov 21 '22 14:11

user3078335


1 Answers

In short: Use SentiWordNet instead and look at https://github.com/kevincobain2000/sentiment_classifier


In Long:

Affectedness vs Sentiment

The line between affect and sentiment is very fine. One should looking into Affectedness in linguistics studies, e.g. http://compling.hss.ntu.edu.sg/events/2014-ws-affectedness/ and Sentiment Analysis in computational researches. For now, let's call both the task of identifying affect and sentiment, sentiment analysis.

Also note that WN-Affect is a rather old resource compared to SentiWordNet, http://sentiwordnet.isti.cnr.it/.

Here's a good resource for using SentiWordNet for sentiment analysis: https://github.com/kevincobain2000/sentiment_classifier.

Often sentiment analysis has only two classes, positive or negative sentiment. Whereas the WN-affect uses 11 types of affectedness labels:

  • emotion
  • mood
  • trait
  • cognitive state
  • physical state
  • hedonic signal
  • emotion-eliciting
  • emotional response
  • behaviour
  • attitude
  • sensation

For each type, there are multiple classes, see https://github.com/larsmans/wordnet-domains-sentiwords/blob/master/wn-domains/wn-affect-1.1/a-hierarchy.xml


To answer the question of how one can use the WN-Affect, there're several things you need to do:

First map WN1.6 to WN3.0 (it's not an easy task, you have to do several mappings, especially the mapping between 2.0-2.1)

Now using the WN-Affect with WN3.0, you can apply

  • the same classification technique as he SentiWordNet sentiment classifier or
  • try to maximize the classes within text and then use some heuristics to choose 'positive' / 'negative'
like image 199
alvas Avatar answered Dec 18 '22 15:12

alvas