Assignment: Sentiment Analysis with Text Mining with R In Chapter 2 of Text Mining with R, the authors introduce sentiment analysis. Your task is to reproduce and extend that example.
Step 1 — Reproduce the Base Example Obtain the primary example code from Chapter 2.
Create a Quarto (.qmd) file that successfully runs this code.
Include a proper citation to the book and the original example code.
Step 2 — Extend the Analysis Extend the original example in two ways:
Use a different text corpus of your choosing (e.g., news articles, book reviews, speeches, social media, etc.).
Add at least one additional sentiment lexicon, which may come from:
Another R package, or
A lexicon you locate through external research.
You should clearly explain how the results differ from the original example.
Warning in inner_join(., get_sentiments("bing")): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 435434 of `x` matches multiple rows in `y`.
ℹ Row 5051 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
"many-to-many"` to silence this warning.
For the extended analysis, I will use the Social Media Sentiments Analysis Dataset from Kaggle,https://www.kaggle.com/datasets/kashishparmar02/social-media-sentiments-analysis-dataset. Unlike the original example, which analyzes Jane Austen’s novels, this dataset contains user-generated social media posts from different platforms, including Instagram, Facebook, and Twitter.
I will apply the Bing, AFINN, and NRC sentiment lexicons to the social media text and compare the results with the original Jane Austen analysis.
2.2 Additional Sentiment Method: VADER
In addition to the three original sentiment lexicons, I will use VADER (Valence Aware Dictionary and sEntiment Reasoner). VADER is a lexicon-based and rule-based sentiment analysis tool designed specifically for social media text. It considers features such as capitalization, punctuation, emoticons, and the intensity of words.
Anticipated challenges
Since this is my first time working with sentiment analysis, I may face challenges when applying different sentiment lexicons to analyze the social media data. Understanding how each lexicon classifies words and interprets sentiment may also be challenging.