Beginner level · Module 6: Introduction to Sentiment Analysis · Lesson 2 of 3
Lexicon-Based Sentiment with VADER
Learners use NLTK's VADER sentiment analyser, read its scores and test how it handles negation, emphasis, emojis and local expressions.
In this lesson you will
- Score text with VADER and interpret the compound score
- Test a sentiment tool on difficult cases
Key concepts
sentiment lexiconSentimentIntensityAnalyzercompound scorenegationemphasis
The lesson
A lexicon-based tool uses a list of words with sentiment scores. NLTK's VADER (from nltk.sentiment import SentimentIntensityAnalyzer, after nltk.download('vader_lexicon')) also applies rules for negation ('not good'), capitals ('GOOD'), exclamation marks and some emojis.
polarity_scores(text) returns negative, neutral and positive proportions and a compound score from -1 (most negative) to +1 (most positive). A common convention is compound ≥ 0.05 positive, ≤ -0.05 negative, otherwise neutral.
VADER was built for English social media. It does not know Juba Arabic words or local expressions, and it can miss sarcasm. Testing it on a hand-labelled local sample shows how far its scores can be trusted.
Step by step
- Score the 15 hand-labelled feedback messages with VADER.
- Convert compound scores to labels and compare with the hand labels.
- Test five tricky messages: negation, sarcasm, capitals, emojis and a Juba Arabic phrase.
- Write which cases VADER handles and which it fails.
Practice activity
Evaluate VADER against hand labels on the feedback set and write a short reliability note.
Expected result: An agreement rate and a reliability note that names the cases where VADER fails.
Check your understanding
-
What range does VADER's compound score use?
Show answer
From -1 (most negative) to +1 (most positive).
-
Why may VADER fail on local messages?
Show answer
Its lexicon covers English social media and does not include local-language words or expressions.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.