Eminem became sober April 20th, 2008 after experiencing a near fatal overdose from prescription medication including Valium and Xanax. I predict that after his sobriety his word choice in his lyrics become more complex, descriptive, and frequent.

First I opened the necessary libraries and assigned the albums as varialbles.

library(tidytext)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
## ✓ tibble  3.1.0     ✓ dplyr   1.0.4
## ✓ tidyr   1.1.2     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(genius)
infinite <- genius_album(artist = "eminem", album="infinite")
## Joining, by = c("album_name", "track_n", "track_url")
The_Slim_Shady_LP <- genius_album(artist = "eminem", album="The_Slim_Shady_LP")
## Joining, by = c("album_name", "track_n", "track_url")
Encore <- genius_album(artist = "eminem", album="Encore")
## Joining, by = c("album_name", "track_n", "track_url")
Relapse <- genius_album(artist = "eminem", album="Relapse")
## Joining, by = c("album_name", "track_n", "track_url")
Recovery <- genius_album(artist = "eminem", album="Recovery")
## Joining, by = c("album_name", "track_n", "track_url")
The_Marshall_Mathers_LP2 <- genius_album(artist = "eminem", album="The_Marshall_Mathers_LP2")
## Joining, by = c("album_name", "track_n", "track_url")
Revival <- genius_album(artist = "eminem", album="Revival")
## Joining, by = c("album_name", "track_n", "track_url")
Kamikaze <- genius_album(artist = "eminem", album="Kamikaze")
## Joining, by = c("album_name", "track_n", "track_url")
Music_to_Be_Murdered_By <- genius_album(artist = "eminem", album="Music_to_Be_Murdered_By")
## Joining, by = c("album_name", "track_n", "track_url")

Pre-Sobriety Sentiment Analysis

I then compared the sentiment of Eminem’s lyrics before and after his sobriety.

presober3 <- rbind(infinite, The_Slim_Shady_LP, Encore)
presober3 %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>%
  inner_join(get_sentiments("nrc")) ->presober3graph
## Joining, by = "word"
## Joining, by = "word"
ggplot(data=presober3graph, aes(x= sentiment, y=n, fill=sentiment)) +
  geom_bar(stat="identity")+
  scale_fill_hue(c = 50) +
  ggtitle("Sentiment analysis of Eminem Pre-sobriety") +
  xlab("Emotions") + ylab("Frequency")+
  theme(legend.position="none")

Post-Sobriety Sentiment Analysis

postsobriety <- rbind(Relapse, Recovery, The_Marshall_Mathers_LP2, Revival, Kamikaze, Music_to_Be_Murdered_By)
postsobriety %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>%
  inner_join(get_sentiments("nrc")) ->postsobrietygraph
## Joining, by = "word"
## Joining, by = "word"
ggplot(data=postsobrietygraph, aes(x= sentiment, y=n, fill=sentiment)) +
  geom_bar(stat="identity")+
  scale_fill_hue(c = 50) +
  ggtitle("Sentiment analysis of Eminem Post-sobriety") +
  xlab("Emotions") + ylab("Frequency")+
  theme(legend.position="none")

While Eminem’s emotions don’t change very much from pre to post sobriety, the frequency he uses them does. Eminem uses more words to express his emotions in every category. This is indicative of a more varied and descriptive vocabulary or a vocabulary that uses words more repetitively to better express emotion. Both scenarios show that there is a clear mental shift from his pre sobriety lyrics and the words he raps today.

Word Cloud Visualization

library(wordcloud2)

Pre-Sobriety Word Cloud

presober3 %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  filter(!word %in% c('t.co', 'https', 'http', 'amp', 'chka', 'ah', 'uh', 'em', 'ha', 'wanna')) %>%
  count(word, sort = TRUE) %>%
  wordcloud2()
## Joining, by = "word"

Post-Sobriety Word Cloud

postsobriety %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  filter(!word %in% c('t.co', 'https', 'http', 'amp', 'chka', 'ah', 'uh', 'em', 'ha', 'wanna')) %>%
  count(word, sort = TRUE) %>%
  wordcloud2()
## Joining, by = "word"

The second word cloud features more positive words like ‘love’ and ‘feel’. This is again indicative of Eminem’s switch to sobriety and the subsequent increase in frequency with positive words. ##Positive and Negative Word Usage Lastly I did a word frequency table to compare the positive and negative word usage from his first and most recent song.

First Album Word Usage

infinte <- genius_album(artist = "eminem", album="infinite")
## Joining, by = c("album_name", "track_n", "track_url")
infinte %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>%
  inner_join(get_sentiments("afinn")) -> infinite_afinn
## Joining, by = "word"
## Joining, by = "word"
infinite_afinn %>%
  arrange(desc(value))%>%
  filter(!word %in% "eminem") %>%
  head(10) %>%
  ggplot(aes(word, value)) + geom_col()

infinite_afinn %>%
  arrange(desc(-value))%>%
  filter(!word %in% "eminem") %>%
  head(10) %>%
  ggplot(aes(word, value)) + geom_col()

## Most Recent Album Word Usage

Music_to_Be_Murdered_By <- genius_album(artist = "eminem", album="Music_to_Be_Murdered_By")
## Joining, by = c("album_name", "track_n", "track_url")
Music_to_Be_Murdered_By %>%
  unnest_tokens(word, lyric) %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>%
  inner_join(get_sentiments("afinn")) -> MTBMB_afinn
## Joining, by = "word"
## Joining, by = "word"
MTBMB_afinn %>%
  arrange(desc(value))%>%
  filter(!word %in% "eminem") %>%
  head(10) %>%
  ggplot(aes(word, value)) + geom_col()

MTBMB_afinn %>%
  arrange(desc(-value))%>%
  filter(!word %in% "eminem") %>%
  head(10) %>%
  ggplot(aes(word, value)) + geom_col()

Conclusion

While Eminem’s negative language remains consistently crude, it varies in other ways. His most negative words are used less frequently in his first album. In his newest album his negative words are much more complex and used more frequently. This is likely due to his sobriety, allowing him to write in a better frame of mind. Additionally, his positive language is more frequent than his first album and features more detailed words like amazing and awesome, rather than ‘positive’ words from the first album such as “haha”. His newest album also frequents the words miracle and rejoice which are word with a much more positive outlook. Overall his word choice points to a person in a better mindset capable of forming lyrics with more complex words more frequently.