Sanil Mhatre walks us through a sentiment analysis scenario in R:
Sentiments can be classified as positive, neutral or negative. They can also be represented on a numeric scale, to better express the degree of positive or negative strength of the sentiment contained in a body of text.
This example uses the Syuzhet package for generating sentiment scores, which has four sentiment dictionaries and offers a method for accessing the sentiment extraction tool developed in the NLP group at Stanford. The
get_sentimentfunction accepts two arguments: a character vector (of sentences or words) and a method. The selected method determines which of the four available sentiment extraction methods will be used. The four methods are
syuzhet(this is the default),
nrc. Each method uses a different scale and hence returns slightly different results. Please note the outcome of
nrcmethod is more than just a numeric score, requires additional interpretations and is out of scope for this article. The descriptions of the
get_sentimentfunction has been sourced from : https://cran.r-project.org/web/packages/syuzhet/vignettes/syuzhet-vignette.html?