library(dplyr)
library(tidyverse)
library(httr)
library(rvest)
library(magrittr)
library(tidytext) Sentiment Analysis of Mavi and Smino User Reviews
RNB Vs Rap
One of my favorite rappers is MAVI, whose 2024 album Shadowbox is currently my favorite. Another artist I enjoy is Smino, who blends rap with R&B influences. His album Blkswn, released in 2017, is one of my top picks from the R&B genre. I have a few hypotheses related to these artists’ music and their reception that I’d like to test through sentiment analysis of user reviews and lyrics. Both Albums have very similar rating gotten from the website: https://www.albumoftheyear.org/
Every data gotten was scraped from https://www.albumoftheyear.org/
Web Scraping User Reviews
set_config(user_agent("Mozilla/5.0 (compatible; Googlebot/2.1; +https://www.google.com/bot.html"))
mavi_html <-
read_html("https://www.albumoftheyear.org/album/990020-mavi-shadowbox/user-reviews/")
reviewer_name <- mavi_html %>%
html_elements(".userReviewName a") %>%
html_text2() %>%
.[. != ""]
reviewer_comment <- mavi_html %>%
html_elements("p") %>%
html_text2() %>%
head(25)
reviewer_score <- mavi_html %>%
html_elements(".rating") %>%
html_text2() %>%
head(25)
mavi <- tibble(reviewer_name, reviewer_comment, reviewer_score, artist = "mavi")
smino_html <-
read_html("https://www.albumoftheyear.org/album/74960-smino-blkswn/user-reviews/")
reviewer_name <- smino_html %>%
html_elements(".userReviewName a") %>%
html_text2() %>%
.[. != ""]
reviewer_comment <- smino_html %>%
html_elements("p") %>%
html_text2() %>%
head(25)
reviewer_score <- mavi_html %>%
html_elements(".rating") %>%
html_text2() %>%
head(25)
smino <- tibble(reviewer_name, reviewer_comment, reviewer_score, artist = "smino")
rapVsrnb <- bind_rows(mavi, smino)Tokenize Comments and Clean Data
comments_tokens <- rapVsrnb %>%
unnest_tokens(word, reviewer_comment)
data("stop_words")
comments_clean <- comments_tokens %>%
anti_join(stop_words, by = "word")Hypothesis 1
Mavi’s reviews will contain a higher count of positive sentiment words compared to Smino’s
Rationale
Shadowbox was released in 2024, it might attract more passionate, positive feedback as listeners engage with fresh music. In contrast, Blkswn was released in 2017, may have a more balanced reception, as it has been out for several years, and older reviews may reflect mixed or neutral sentiments.
sentiment <- get_sentiments("bing")
comment_sentiment <- comments_clean %>%
inner_join(sentiment, by = "word") %>%
count(artist, sentiment, sort = TRUE)
comment_sentiment %>%
ggplot(aes(x = artist, y = n, fill = sentiment)) +
geom_bar(stat = "identity", position = "dodge") +
labs(
title = "Sentiment Analysis of Comments by Artist",
x = "Artist",
y = "Count",
fill = "Sentiment"
)Results
As expected Mavi’s ablum shadowbox contains more positive reviews than that of smino’s album
Hypothesis 2
Mavi’s Shadowbox reviews will show a higher positive sentiment difference compared to Smino’s Blkswn reviews.
Rationale
As I mentioned in the first hypothesis the Shadowbox album by Mavi is more recent, and recent releases often get a higher level of excitement and emotion from listeners, which could lead to more extreme sentiments in user reviews (both positive and negative). On the other hand, Blkswn by Smino, has been out for several years which could result in more balanced and reflective sentiments from users who have had more time to listen to the music
comment_sentiment <- comments_tokens %>%
inner_join(sentiment, by = "word") %>%
group_by(artist, reviewer_name, sentiment) %>%
summarize(n = n()) %>%
spread(sentiment, n, fill = 0) %>%
mutate(sentiment_diff = positive - negative) `summarise()` has grouped output by 'artist', 'reviewer_name'. You can override
using the `.groups` argument.
comment_sentiment %>%
ggplot(aes(x = reorder(reviewer_name, sentiment_diff), y = sentiment_diff, fill = artist)) +
geom_col(show.legend = FALSE) +
scale_fill_brewer(palette = "Set1") +
facet_wrap(~artist, ncol = 2, scales = "free_x") +
labs(
title = "Sentiment Difference in User Reviews",
subtitle = "Comparing Sentiment of Mavi's *Shadowbox* and Smino's *Blkswn*",
x = "Reviewer",
y = "Sentiment Difference (Positive - Negative)"
) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) Results
Although my hypothesis was current the review made by adincoolest is extremely high and the blkswn has fewer negative comments when compared to Mavi’s shadowbox which might contradict the previous hypothesis
Hypothesis 3
What emotions does Smino’s album have better results over Mavi’s album
Rationale
Since Smino’s album is in the RNB genre which tends to be slow and sad while Mavi Album is in the rap genre which tends to be pretty aggressive
nrc <- get_sentiments("nrc")
emotion_data <- comments_tokens %>%
inner_join(nrc, by = "word") %>%
count(artist, sentiment, sort = TRUE)Warning in inner_join(., nrc, by = "word"): Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 32 of `x` matches multiple rows in `y`.
ℹ Row 8428 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship =
"many-to-many"` to silence this warning.
emotion_data %>%
ggplot(aes(x = sentiment, y = n, fill = artist)) +
geom_bar(stat = "identity", position = "dodge") +
scale_fill_brewer(palette = "Set1") +
labs(
title = "Mavi vs Smino",
subtitle = "Emotion Analysis of User Reviews for *Shadowbox* and *Blkswn*",
x = "Emotion",
y = "Count",
fill = "Artist"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))Results
I was expecting smino’s comments to show more sadness because of his genre, but it also does make sense for mavi’s comment section to have a higher sadness because although his genre is rap its kind of similar to slow rap not really the aggressive type
I could also just be overthinking the situation. It could just be that people are more just sad that the album didn’t meet there expectation