Advertisement

Sentiment Analysis Made Easy Using VADER

Sentiment Analysis is used to analyse the emotion of the text. In other words, it is the process of detecting a positive or negative emotion of a text.

So, putting it in simple words, by using sentiment analysis we can detect whether the given sentence, paragraph or a document contains a positive or negative emotion/opinion in it.

Use-Case of Sentiment Analysis

Since customer nowadays is open and more abrupt in expressing their views about the products or services they use, sentiment analysis becomes an essential tool for the companies to know their customers in-depth and better.

Sentiment Analysis enables companies to know what kind of emotion/sentiment do customers have for them. This can play a huge role because companies can improve their products/services based on the analysis of customer sentiments.

Challenges Faced During Analysis of Sentiments

You might be thinking that a sentence having positive or good words will be analysed as positive sentiment & vice-versa a sentence having negative words will be analysed as the negative sentiment.

While the challenge here is that different people write their opinions in different ways, some people express their opinion straight while some may prefer adding sarcasm to their opinion. Also, some might have both positive and negative opinions.

For example: “This car is good but its mileage could’ve been better”

In the above scenario, the opinion of a user is on both sides. But we have a good solution for this situation which can to some extent can make our analysis easier. Let’s have a look at it in the upcoming paragraph.

Introducing VADER

VADER (Valence Aware Dictionary and sEntiment Reasoner) is a lexicon and rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media. 

It is used for sentiment analysis of text which has both the polarities i.e. positive/negative. VADER is used to quantify how much of positive or negative emotion the text has and also the intensity of emotion.

Advantages

Here are the advantages of using VADER which makes a lot of things easier:

  • It does not require any training data.
  • It can very well understand the sentiment of a text containing emoticons, slangs, conjunctions, capital words, punctuations and much more.
  • It works excellent on social media text.
  • VADER can work with multiple domains.

Let’s start analysing the sentiment using VADER.

First, let’s install VADER from https://pypi.org/project/vaderSentiment/  by using the command line:

pip install vaderSentiment

Now, let’s start writing our script:

Here, SentimentIntensityAnalyzer() is an object and polarity_scores is a method which will  give us scores of the following categories:

  • Positive
  • Negative
  • Neutral
  • Compound

The compound score is the sum of positive, negative & neutral scores which is then normalized between -1(most extreme negative) and +1 (most extreme positive).

The more Compound score closer to +1, the higher the positivity of the text.

Above text is 49.2% Positive, 0% Negative, 50.8% Neutral. While the compound score is 44.04%.

Let’s look at some examples

Example-1

In the above scenario we can see that with the use of conjunction in a sentence, the positive & compound score has decreased.

——————————————————————————————————————————-

Example-2

In this scenario, with the use of smiley (emoji) in a sentence, the positive score and compound score has increased. 

——————————————————————————————————————————-

Example-3

Here we can see that with the use of capital word & exclamation mark, the positive score & compound score has increased. 

The second sentence is more intense, positive and so the compound score of the second sentence is more.

The compound score will increase as the intensity of the text will increase towards positive.

Conclusion:

VADER classifies the sentiments very well. It is easy to use, the ready-made model which can be used across multiple domains, social-media texts, analysing reviews etc. The cherry on the cake when using VADER is it does not require any training data. Well, we can see that the results obtained are very excellent!! 

Download our Mobile App

Falak Singh
I am a Machine Learning Scientist and like to research the use cases of Artificial intelligence and how it can be leveraged for business purposes. The curiosity of knowing anything in-depth that is what defines me. Analytics is more about the interest in knowing anything in-depth and getting a result from the same. Apart from this, I am an Automobile fanatic and spend my time around it.

Subscribe to our newsletter

Join our editors every weekday evening as they steer you through the most significant news of the day.
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Our Upcoming Events

15th June | Online

Building LLM powered applications using LangChain

17th June | Online

Mastering LangChain: A Hands-on Workshop for Building Generative AI Applications

Jun 23, 2023 | Bangalore

MachineCon 2023 India

26th June | Online

Accelerating inference for every workload with TensorRT

MachineCon 2023 USA

Jul 21, 2023 | New York

Cypher 2023

Oct 11-13, 2023 | Bangalore

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
MOST POPULAR