Wednesday 30 January 2013

extracting emotion from text

Here we shall look at a simple procedure to perform a sentiment analysis of the given text,

We proceed by making a list of words and associating with a value indicating the degree of emotion conveyed by the same.

something like :

awesome 4
bad -3
sad -3
cool 2

etc

Here the positive value indicate a positive emotion ,and the negative with negative emotion conveying words.The value indicate the degree of emotion conveyed by that word.
Now all we have to do is demarcate the text into constituent words and individually look up in this list,and sum up or take the average of the corresponding value to get the emotion value conveyed by the text.You can be wise enough to avoid usage of "stop words" in the list as they do not convey any meaning. 

Personally i adore python for the awesome text processing capabilities , you can use the text as key and look it up as a dictionary ,have a look here.

 A front end browser with a backend python script computing the emotion conveyed.

You can also use twitter to get general opinion on a particular topic

use http://search.twitter.com/search.json?q=topic_name

 (all spaces in topic_name is to be replaced with +)

Twitter returns data in json format which you have to parse to extract the texts and use your python script to compute the emotion values which you can add or average as a whole to get general opinion



No comments:

Post a Comment