Sentiment analysis is used in organizations to identify particular customer units, find patterns and trends, and know the customer’s impression.
A real-time example is if you were to score the reviews/comments on various social media platforms and classify them accordingly.
Sentiment analysis is a straight forward process. Let’s discuss the steps with the example The food is good.
Tokenization divides the sentence, including punctuation, into tokens. For example, take the sentence The food is good.
After tokenization, it will become:
Tokenization |
---|
The |
food |
is |
good |
. |
In this step all the (
,.
,,
,!
, etc.)
In the given example, .
is removed, which leaves us with, The food is good
.
Cleaneased |
---|
The |
food |
is |
good |
Stop words are words like, and, are, the was, is, etc.
So, after we remove the stop words in our example (is
and the
), only good
and food
will be left.
Stop Words Removal |
---|
food |
good |
Now, the data is will be classified as negative, positive, or neutral and will be given a point from -1 to 1.
In the stated example, food
is neutral, so the given score will be 0,
and good
, so the given score will be 1.
Words | Score |
---|---|
food | neutral (0) |
good | positive (1) |
Now, we just need to add the points from the previous step.
Since our example is now 0
and 1
, and 0 + 1 = 1
, the feedback is positive.
Note: if the polarity is greater than zero, it is positive. If the polarity is less than zero, it is negative.