$ pip install vaderSentiment
Sentiment Analysis with VADER
Upasana | May 05, 2019 | 2 min read | 323 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
Here i am listing down the situations in which you can use VADER:
-
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.
-
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.
-
You can use VADER when you want to classify rating of a movie based on its dialogues.
-
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.
-
We can collect intensity scores and do data visualization as well.
-
You can also edit VADER and make it more broader as per requirement.
Top articles in this category:
- Google Data Scientist interview questions with answers
- Python send GMAIL with attachment
- Top 100 interview questions on Data Science & Machine Learning
- Python coding challenges for interviews
- Flask Interview Questions
- Connect to MySQL with Python 3.x and get Pandas Dataframe
- SVM after LSTM deep learning model for text classification