Sentiment analysis is basically the process of computationally determining whether the comments are neutral, positive or negative. Another term used for it is ‘Opinion Mining’, which derives the opinion or attitude of a viewer or speaker.
Sentiment analysis through Twitter is done by a scoring sentence using the language ‘R’. It essentially maps the sentiment types which are pre-defined (negative or positive) or a value which means how positive or negative the words and sentence is. It is always a good idea to focus on simple sentiments and analyze them focusing on the word level.
Here is an example,
Let’s say the comment on Twitter is “I’m not feeling good”.
To calculate the sentiment score, let’s break this sentence and map it using pre-defined sentiment type. This mapping would look like this.
|Mapping of sentiments
If we consider the above sentence, it has sentimental value only for the word ‘Good’ which is obviously positive. Hence, the comment should be positive. But actually, we know that it is not so. Here, in this case, ‘Sentiment’ comes into the picture.
Sentiment scoring function goes beyond simple word to sentiment and takes into account intensifiers, negations, contextual valence shifters. The ‘get_sentiment’ function is used for this sentiment function. When the command is run, it shows the value in front of each word, it may be either be positive or negative, which reveals that intensifiers and negations in the sentence influence the result.