Learn R Programming

vader (version 0.0.2)

getVader: VADER (Valence Aware Dictionary and sEntiment Reasoner)

Description

Vader is a lexicon and rule-based sentiment analysis tool that is specifically attuned to sentiments expressed in social media.

Usage

getVader(text, incl_nt = T, neu_set = T)

Arguments

text

to be analyzed

incl_nt

defaults to T, indicates whether you wish to incl 'nt contractions in negation analysis

neu_set

defaults to T, indicates whether you wish to count neutral words in calculations

Value

A vector containing the valence score for each word; an overall, compound valence score for the text; the percentage of positive, negative, and neutral words in the text; and the frequency of the word "but".

N.B.

In the examples below, "yesn't" is an internet neologism meaning "no", "maybe yes, maybe no", "didn't", etc.

Details

Use getVader() to calculate the valence of a text document.

References

For the original Python Code, please see:

  • https://github.com/cjhutto/vaderSentiment

  • https://github.com/cjhutto/vaderSentiment/blob/master/vaderSentiment/vaderSentiment.py

For the original R Code, please see:

  • https://github.com/nrguimaraes/sentimentSetsR/blob/master/R/ruleBasedSentimentFunctions.R

Modifications to the above scripts include, but are not limited to:

  • ALL CAPS fx: updated to account for non-alpha words; i.e. "I'M 100 PERCENT SURE" would previously have been counted as mixed case due to the use of numbers

  • IDIOMS fx: added capacity to check for idioms that do not contain any words found in the Vader Lexicon

  • WORDS+EMOT: strip punctuation while preserving ALL emoticons found in dictionary

  • Option to turn on/off neutral count

Examples

Run this code
# NOT RUN {
getVader("I yesn't like it")
getVader("I yesn't like it", incl_nt = FALSE)
getVader("I yesn't like it", neu_set = FALSE)
# }

Run the code above in your browser using DataLab