Sentiment Analysis with VADER

Carvia Tech | May 05, 2019 | 2 min read | 197 views


When we want to do sentiment analysis, first target is always to do classification between negative and positive sentences. We all use various machine learning algorithms and deep learning models to help machine learn to differentiate between negative and positive sentences.

But if you are someone who is very well familiar with NLP, must have been familiar with VADER.

We can use VADER for getting polarity of a sentence very simply without much hassle of building models.

VADER is best choice and one of the easiest package to use to find out polarity of sentences because it doesn’t only tell polarity of sentence but gives polarity score as well. Reach out to it here: https://github.com/cjhutto/vaderSentiment

This can be installed via pip as well

$ pip install vaderSentiment

Here i am listing down the situations in which you can use VADER:

  1. You need to do text classification of articles then there is this one feature you can introduce in your data which will tell combined polarity of a sentence.

    from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
    from nltk.tokenize import sent_tokenize, word_tokenize
    
    article = "Google staff awoke on Wednesday to surprising news: Their company is working on a search app tailored, and censored, for China. The project, kept secret from all but select teams and leaders, sparked a furious internal debate. Yet the move couldn't have been entirely surprising for Googlers."
    
    article_tokenized = sent_tokenize(article) # Tokenising text into sentences
    
    analyzer = SentimentAnalyzer()  #Intialising sentimentanalyzer class
    
    neg_scores = []
    pos_scores = []
    for i in article_tokenized:
        print(analyser.polarity_scores(i))
        neg_scores.append(analyser.polarity_scores(i)['neg'])
        pos_scores.append(analyser.polarity_scores(i)['pos'])

    This way you will have lists of negative scores and positive scores for an article of which you can take weighted average or just average and introduce that as a feature in your data.

  2. When you are finding context of sentences and sentiment analysis as well then VADER can also be used to find intensity of the statement directed to the person.

  3. You can use VADER when you want to classify rating of a movie based on its dialogues.

  4. When you are building e-commerce chatbot so you will know if some customer is likely to buy something or not by checking positive score of customer’s behaviour.

  5. We can collect intensity scores and do data visualization as well.

  6. You can also edit VADER and make it more broader as per requirement.


Top articles in this category:
  1. Google Data Scientist interview questions with answers
  2. Python coding challenges for interviews
  3. Top 100 interview questions on Data Science & Machine Learning
  4. Python Flask Interview Questions
  5. Send email with attachment in Python
  6. SVM after LSTM deep learning model for text classification
  7. Named Entity Recognition using spaCy and Flask


Find more on this topic:
Machine Learning image
Machine Learning

Data science, machine learning, python, R, big data, spark, the Jupyter notebook, and much more

Last updated 1 week ago


Recommended books for interview preparation:

This website uses cookies to ensure you get the best experience on our website. more info