March 20, 2017

A sentiment analysis of Kanye West records

Kanye West is responsible for some of the realest, funniest (“if you fall on the concrete thats your ass fault”…ass fault…asphalt…anyone?) and inspiring lyrics in music, period. Can the application of sentiment analysis techniques help us understand more about his art?1

This is not a sentiment analysis of the music per se - nothing in here about keys, tempo, melody or any other components of music that influence the emotional valence of the piece2 - the analysis is reflective of the lyrical content only, while the sample is limited to Ye’s solo studio albums (album editions taken from here). Also, the analysis includes lyrics from artists featured on the records, so is representative of the body of work rather than the individual.

First look

To begin with, a simple look at Ye’s lyric count by album:

The College Dropout is clearly the album with biggest (lyrical) bang for your buck, registering 13,679 words. 808s & Heartbreak and Yeezus lag the farthest behind (below five-thousand a piece, and around one-third of College Dropout), and with good reason - 808s is memorably less lyrically dense than the others, while the latter has the smallest number of tracks.

We can normalise by track length and give a measure of ‘lyrical density’ (words-per-second) across time:

album_word_counts <- tidy_df %>%
  count(n(), album) 

album_data <- df %>%
  group_by(album) %>%
  summarise(duration=sum(duration)) %>%
  left_join(album_word_counts, by="album") %>%

ggplot(album_data, aes(x = count_per_sec, y = fct_rev(album))) +
  geom_lollipop(point.colour = ghibli_palettes$SpiritedMedium[4], point.size = 3, horizontal = TRUE) +
  scale_x_continuous(limits = c(0, 3), expand = expand_scale(mult = c(0, .1))) +
  scale_y_discrete(labels = function(x) str_wrap(x, width = 20)) +
  theme_ewen_ws(axis = "y", base_size = 11, plot_title_size = 16) +
  theme(axis.text.y = element_text(margin = margin(r = 10), size = 10)) +
  labs(title = "Words-per-second in Kanye West albums",
       x = NULL, y = NULL,
       subtitle = "Records in chronological order",
       caption = chart_caption)

Again, as expected, 808s hangs back in the words-per-second stakes. The Life Of Pablo (TLOP) exhibits a lyrical pace more comparable to Kanye’s earlier albums (College Dropout stays top, still). It’s trickier to say for sure if his flow/delivery is a throwback from this metric alone (would be more optimal if tempo was incorporated into this equation, and remember that this figure includes breakdowns, outros, etc.) but maybe someone’s been listening…

It’s worth taking a look at how some of this looks across tracks, too.

‘Last Call’ stands lone and tall at 2,745 words, with most in and around the 500-mark. However, ‘Last Call’ is also the longest Kanye album track (12:40(!!)). As before, what happens if we normalise by track length?

Now, ‘Freestyle 4’ off of TLOP is highest - remember, this metric of lyrical density is inclusive of breakdowns and such. If you listen to this track which is just over two-minutes long, you’ll see there is literally no let-up from the big man.

For good measure, let’s end this section with a quick look at the range of lyric counts by record (hint: excuse for the dumbbell chart):

How similar are Graduation, 808s and Yeezus?


We’ve touched on things like the word count and lyrical density of Kanye’s records. Now, lets start to explore what is actually being said.

Note: from this point on, English ‘stop words’ (e.g. and, or, but) are excluded from the analysis.

Kanye’s confirmed it, everyone - love conquers all (even sh*t). We’ll need to dig further to get into the emotion and the message contained in the tracks that embody these words, though.

I tried to quantify the amount of different types of sentiment in Kanye’s lyrics by using tidytext. In this case, I went with the NRC lexicon developed by Saif Mohammad which associates words with some sentiment categories: positive, negative, anger, anticipation, disgust, fear, joy, sadness, surprise, and trust. As a Psychology graduate with some experience in qualitative analysis (and as a music lover, first and foremost) I’m mindful that a lexicon is a simplification that will undoubtedly miss important contextual and cultural cues (especially important in understanding art that nod to lots of subcultures), but can provide us with a useful summary in evaluating the lyric’s emotional composition.

So, what did we learn here? It looks like Graduation’s lyrics have the highest (proportional) rate of anticipation and surprise sentiment, compared to the other records. Interestingly, this is in keeping with the themes captured in Takashi Murukami’s cover art (below), where we see ‘Dropout Bear’ being thrust out into a new world.

My Beautiful Dark Twisted Fantasy has the highest rate of anger and disgust, comparitively. Again, these are prominent in George Condo’s bastardized, surreal vision for the record.

Can we look at this record closer to see where these kinds of feelings are most prominent?

The above uses the Bing lexicon to examine how positive/negative sentiment manifests by track in My Beautiful Dark Twisted Fantasy. ‘Monster’ is furthest to the left with the highest ratio of negative to positive sentiment in it’s lyrics, followed closely by ‘So Appalled’. In fact, ‘All of the Lights’ would appear to be the only real respite for ‘positive’ lyrical sentiment.

What if we apply this to the rest of the discography, and see which tracks score highest for positive/negative sentiment across the board?

It might be surprising to see ‘Amazing’ way out in front (n.b. I explain Love Lockdown’s perhaps false position in the conclusion). Remember, this is based on lyrics only - here’s a reminder of the hook…

No matter what, you’ll never take that from me, My reign is as far as your eyes can see; It’s amazing, so amazing, so amazing, so amazing, It’s amazing, so amazing, so amazing, so amazing It’s amazing, so amazing, so amazing, so amazing It’s amazing, so amazing, so amazing, so amazing It’s amazing

Some last words

We were able to answer some novel questions with this analysis. How many lyrics are in Kanye’s tracks and albums/tracks, and how are these distributed by track and within-track (lyrical density)? What lyrics are most common, and how can we summarise the emotional content of these lyrics using different categories of sentiment? How does this look at an album and track level?

Of course, we’re missing the full story by just considering words as individual units and the relationship to sentiment in this way. Lyric’s meaning often comes from their relation to each other. In future, one can try and get at this by exploring the co-occurrence of words, or consecutive sequences of words known as n-grams, and validating sentiment scores by understanding context (e.g. ‘loving’ preceded by ‘not’ in ‘Love Lockdown’ would not have been picked up here, hence why it scored unexpectedly high on ‘positive’ sentiment).

Finally, a treat for those who know. Thanks for letting me get in my zone.

  1. To keep the post concise I don’t show all of the code, especially code that generates figures. You can find the full code here. Update: I was pretty green when I wrote this post, and the code quality reflected this. The data prep was very hacky and in no way reproducible, so I’ve removed that part (soz).

  2. some of these factors are captured by Spotify, as explored in this piece (a big inspiration for this post). This data was not available for Kanye’s full studio discography through the Spotify API, at the time of this analysis.