VADER-Sentiment-Analysis in Java
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 fully open-sourced under the MIT License (we sincerely appreciate all attributions and readily accept most contributions, but please don't hold us liable).
This is a JAVA port of the NLTK VADER sentiment analysis originally written in Python.
- The Original python module by the paper's author C.J. Hutto
- The NLTK source
For the testing I have compared the results of the NLTK module with this Java port.
Update (Jan 2017)
I have corrected a few bugs that I encountered when I was adding more tests.
The details are here.
This project now includes tests on text from:
- Amazon Reviews
- Movie Reviews
- NyTimes Editorial snippets
Introduction
This README file describes the dataset of the paper:
VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text
(by C.J. Hutto and Eric Gilbert)
Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.
For questions, please contact:
C.J. Hutto
Georgia Institute of Technology, Atlanta, GA 30032
cjhutto [at] gatech [dot] edu
Citation Information
If you use either the dataset or any of the VADER sentiment analysis tools (VADER sentiment lexicon or Python code for rule-based sentiment analysis engine) in your research, please cite the above paper. For example:
Hutto, C.J. & Gilbert, E.E. (2014). VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text. Eighth International Conference on Weblogs and Social Media (ICWSM-14). Ann Arbor, MI, June 2014.
Resources and Dataset Descriptions
The compressed .tar.gz package includes PRIMARY RESOURCES (items 1-3) as well as additional DATASETS AND TESTING RESOURCES (items 4-12):
-
VADER: A Parsimonious Rule-based Model for Sentiment Analysis of Social Media Text
The original paper for the data set, see citation information (above).
-
vader_sentiment_lexicon.txt
Empirically validated by multiple independent human judges, VADER incorporates a "gold-standard" sentiment lexicon that is especially attuned to microblog-like contexts.
The VADER sentiment lexicon is sensitive both the polarity and the intensity of sentiments
expressed in social media contexts, and is also generally applicable to sentiment analysis
in other domains.
Manually creating (much less, validating) a comprehensive sentiment lexicon is
a labor intensive and sometimes error prone process, so it is no wonder that many
opinion mining researchers and practitioners rely so heavily on existing lexicons
as primary resources. We are pleased to offer ours as a new resource.
We begin by constructing a list inspired by examining existing well-established
sentiment word-banks (LIWC, ANEW, and GI). To this, we next incorporate numerous
lexical features common to sentiment expression in microblogs, including
- a full list of Western-style emoticons, for example, :-) denotes a smiley face
and generally indicates positive sentiment)
- sentiment-related acronyms and initialisms (e.g., LOL and WTF are both examples of
sentiment-laden initialisms)
- commonly used slang with sentiment value (e.g., nah, meh and giggly).
This process provided us with over 9,000 lexical feature candidates. Next, we assessed
the general applicability of each feature candidate to sentiment expressions. We
used a wisdom-of-the-crowd13 (WotC) approach (Surowiecki, 2004) to acquire a valid
point estimate for the sentiment valence (intensity) of each context-free candidate
feature. We collected intensity ratings on each of our candidate lexical features
from ten independent human raters (for a total of 90,000+ ratings). Features were
rated on a scale from "[–4] Extremely Negative" to "[4] Extremely Positive", with
allowance for "[0] Neutral (or Neither, N/A)".
We kept every lexical feature that had a non-zero mean rating, and whose standard
deviation was less than 2.5 as determined by the aggregate of ten independent raters.
This left us with just over 7,500 lexical features with validated valence scores that
indicated both the sentiment polarity (positive/negative), and the sentiment intensity
on a scale from –4 to +4. For example, the word "okay" has a positive valence of 0.9,
"good" is 1.9, and "great" is 3.1, whereas "horrible" is –2.5, the frowning emoticon :(
is –2.2, and "sucks" and it's slang derivative "sux" are both –1.5.
-
vaderSentiment.py
The Python code for the rule-based sentiment analysis engine. Implements the
grammatical and syntactical rules described in the paper, incorporating empirically
derived quantifications for the impact of each rule on the perceived intensity of
sentiment in sentence-level text. Importantly, these heuristics go beyond what would
normally be captured in a typical bag-of-words model. They incorporate word-order
sensitive relationships between terms. For example, degree modifiers (also called
intensifiers, booster words, or degree adverbs) impact sentiment intensity by either
increasing or decreasing the intensity. Consider these examples:
(a) "The service here is extremely good"
(b) "The service here is good"
(c) "The service here is marginally good"
From Table 3 in the paper, we see that for 95% of the data, using a degree modifier
increases the positive sentiment intensity of example (a) by 0.227 to 0.36, with a
mean difference of 0.293 on a rating scale from 1 to 4. Likewise, example (c) reduces
the perceived sentiment intensity by 0.293, on average.
-
tweets_GroundTruth.txt
NOTE: This java module uses this file for testing.
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, and TWEET-TEXT
DESCRIPTION: includes "tweet-like" text as inspired by 4,000 tweets pulled from Twitter’s public timeline, plus 200 completely contrived tweet-like texts intended to specifically test syntactical and grammatical conventions of conveying differences in sentiment intensity. The "tweet-like" texts incorporate a fictitious username (@anonymous) in places where a username might typically appear, along with a fake URL ( http://url_removed ) in places where a URL might typically appear, as inspired by the original tweets. The ID and MEAN-SENTIMENT-RATING correspond to the raw sentiment rating data provided in 'tweets_anonDataRatings.txt' (described below).
-
tweets_anonDataRatings.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, STANDARD DEVIATION, and RAW-SENTIMENT-RATINGS
DESCRIPTION: Sentiment ratings from a minimum of 20 independent human raters (all pre-screened, trained, and quality checked for optimal inter-rater reliability).
-
nytEditorialSnippets_GroundTruth.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, and TEXT-SNIPPET
DESCRIPTION: includes 5,190 sentence-level snippets from 500 New York Times opinion news editorials/articles; we used the NLTK tokenizer to segment the articles into sentence phrases, and added sentiment intensity ratings. The ID and MEAN-SENTIMENT-RATING correspond to the raw sentiment rating data provided in 'nytEditorialSnippets_anonDataRatings.txt' (described below).
-
nytEditorialSnippets_anonDataRatings.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, STANDARD DEVIATION, and RAW-SENTIMENT-RATINGS
DESCRIPTION: Sentiment ratings from a minimum of 20 independent human raters (all pre-screened, trained, and quality checked for optimal inter-rater reliability).
-
movieReviewSnippets_GroundTruth.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, and TEXT-SNIPPET
DESCRIPTION: includes 10,605 sentence-level snippets from rotten.tomatoes.com. The snippets were derived from an original set of 2000 movie reviews (1000 positive and 1000 negative) in Pang & Lee (2004); we used the NLTK tokenizer to segment the reviews into sentence phrases, and added sentiment intensity ratings. The ID and MEAN-SENTIMENT-RATING correspond to the raw sentiment rating data provided in 'movieReviewSnippets_anonDataRatings.txt' (described below).
-
movieReviewSnippets_anonDataRatings.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, STANDARD DEVIATION, and RAW-SENTIMENT-RATINGS
DESCRIPTION: Sentiment ratings from a minimum of 20 independent human raters (all pre-screened, trained, and quality checked for optimal inter-rater reliability).
-
amazonReviewSnippets_GroundTruth.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, and TEXT-SNIPPET
DESCRIPTION: includes 3,708 sentence-level snippets from 309 customer reviews on 5 different products. The reviews were originally used in Hu & Liu (2004); we added sentiment intensity ratings. The ID and MEAN-SENTIMENT-RATING correspond to the raw sentiment rating data provided in 'amazonReviewSnippets_anonDataRatings.txt' (described below).
-
amazonReviewSnippets_anonDataRatings.txt
FORMAT: the file is tab delimited with ID, MEAN-SENTIMENT-RATING, STANDARD DEVIATION, and RAW-SENTIMENT-RATINGS
DESCRIPTION: Sentiment ratings from a minimum of 20 independent human raters (all pre-screened, trained, and quality checked for optimal inter-rater reliability).
-
Comp.Social website with more papers/research: Comp.Social
-
vader_sentiment_comparison_online_weblink
A short-cut hyperlinked to the online (web-based) sentiment comparison using a "light" version of VADER. http://www.socialai.gatech.edu/apps/sentiment.html .
Java Code EXAMPLE:
public static void main(String[] args) throws IOException {
ArrayList<String> sentences = new ArrayList<String>() {{
add("VADER is smart, handsome, and funny.");
add("VADER is smart, handsome, and funny!");
add("VADER is very smart, handsome, and funny.");
add("VADER is VERY SMART, handsome, and FUNNY.");
add("VADER is VERY SMART, handsome, and FUNNY!!!");
add("VADER is VERY SMART, really handsome, and INCREDIBLY FUNNY!!!");
add("The book was good.");
add("The book was kind of good.");
add("The plot was good, but the characters are uncompelling and the dialog is not great.");
add("A really bad, horrible book.");
add("At least it isn't a horrible book.");
add(":) and :D");
add("");
add("Today sux");
add("Today sux!");
add("Today SUX!");
add("Today kinda sux! But I'll get by, lol");
}};
for (String sentence : sentences) {
System.out.println(sentence);
SentimentAnalyzer sentimentAnalyzer = new SentimentAnalyzer(sentence);
sentimentAnalyzer.analyse();
System.out.println(sentimentAnalyzer.getPolarity());
}
}
Online (web-based) Sentiment Comparison using VADER
http://www.socialai.gatech.edu/apps/sentiment.html .