Skip to main content
QUICK REVIEW

[Paper Review] A review of sentiment computation methods with R packages

Maurizio Naldi|arXiv (Cornell University)|Jan 24, 2019
Advanced Text Analysis TechniquesComputer Science14 references22 citations
TL;DR

This paper evaluates four R packages for sentiment analysis—syuzhet, Rsentiment, SentimentR, and SentimentAnalysis—focusing on their sentiment computation methods, lexicon support, and handling of linguistic complexities like negators. SentimentR is the only package that properly accounts for negators and valence shifters, making it the most accurate for nuanced sentiment scoring.

ABSTRACT

Four packages in R are analyzed to carry out sentiment analysis. All packages allow to define custom dictionaries. Just one - Sentiment R - properly accounts for the presence of negators.

Motivation & Objective

  • To evaluate and compare the capabilities of four R packages for sentiment analysis in terms of lexicon variety, custom dictionary support, and linguistic feature handling.
  • To identify critical limitations in existing sentiment analysis tools, particularly regarding the treatment of negators and valence shifters.
  • To provide researchers and practitioners with a clear, evidence-based guide to selecting the most suitable R package for sentiment analysis tasks.
  • To highlight the importance of syntactic awareness in sentiment scoring, especially for accurate polarity detection in negated or modified expressions.

Proposed method

  • The study analyzes four R packages—syuzhet, Rsentiment, SentimentR, and SentimentAnalysis—using a comparative framework based on their core sentiment computation functions.
  • Each package is evaluated on its support for multiple sentiment lexicons, including standard ones like Afinn, Bing, NRC, and Syuzhet, as well as custom dictionary creation.
  • The analysis focuses on how each package handles linguistic features such as negators (e.g., 'not'), amplifiers, de-amplifiers, and pause words that affect sentiment polarity.
  • SentimentR implements a window-based approach (4 words before, 2 after) to detect valence shifters and adjust sentiment scores accordingly, using rules for negator count parity.
  • The study uses controlled sentence sets to test sentiment scores, particularly focusing on negated and modified expressions to assess accuracy.
  • Quantitative comparisons are drawn using sentiment scores from sample sentences, especially to evaluate whether negated statements receive appropriate negative polarity.

Experimental results

Research questions

  • RQ1How do the four R packages differ in their support for sentiment lexicons and custom dictionary creation?
  • RQ2To what extent do the packages account for negators and other valence shifters in sentiment scoring?
  • RQ3What is the impact of syntactic structure (e.g., negation, amplification) on sentiment scores produced by each package?
  • RQ4Which package provides the most accurate sentiment scores for complex or negated sentences?
  • RQ5What are the key limitations of existing R-based sentiment analysis tools in handling linguistic nuances?

Key findings

  • Among the four R packages evaluated, only SentimentR properly accounts for negators by analyzing a 4-word window before and 2 words after a polarized word.
  • SentimentR adjusts sentiment scores based on the presence of negators, amplifiers, and de-amplifiers, applying rules that consider the parity of negator count within the window.
  • The syuzhet package supports four built-in lexicons (Syuzhet, Afinn, Bing, NRC), with Syuzhet offering the highest resolution (16 sentiment levels) and largest size (10,748 words).
  • The SentimentAnalysis package supports multiple domain-specific dictionaries, including finance-specific ones like Loughran-McDonald and Henry, but fails to handle negators correctly.
  • All packages except SentimentR produce identical sentiment scores for 'This device is good' and 'This device is not good', indicating a critical flaw in negation handling.
  • SentimentR’s highlight() function with sentiment_by() provides a visual HTML output that color-codes positive (green) and negative (red) terms, enhancing interpretability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.