What is lexicon-based sentiment analysis?
What is sentiment analysis?
Where is sentiment analysis used?
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.
Step-by-step
Sentiment analysis is a straight forward process. Let’s discuss the steps with the example The food is good.
Step 1: Tokenization
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 |
| . |
Step 2: Cleaning the data
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 |
Step 3: Removing stop words
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 |
Step 4: Classification
Now, the data is will be classified as negative, positive, or neutral and will be given a point from -1 to 1.
- negative means -1
- positive means 1
- neutral means 0
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) |
Step 5: Calculation
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.