The Data Science of “Someone Like You” or Sentiment Analysis of Adele’s Songs

An extensive analysis of Adele's songs using Natural Language Processing (NLP) on the lyrics, to uncover the underlying emotions and sentiments.



Songs associated with different emotions

So, specifically which song is positive? Which one is negative? And which songs are most associated with emotions such as joy, sadness, anger? Let’s find out!

 
lyric_sentiment %>% 
  count(track_title,sentiment,sort=TRUE) %>% 
  group_by(sentiment) %>%
  top_n(n=5) %>% 
  ggplot(aes(x=reorder(track_title,n),y=n,fill=sentiment)) + 
  geom_bar(stat="identity",show.legend = FALSE) + 
  facet_wrap(~sentiment,scales="free") + 
  xlab("Sentiments") + ylab("Scores")+
  ggtitle("Top songs associated with emotions and sentiments") +
  coord_flip()

The chart shows that ‘Why do you love me’ is the most positive song while ‘He won’t go’ and ‘River Lea’ are the negative songs. In terms of anger and sadness ‘River Lea’ and ‘Rolling in the deep’ score the highest respectively.
Adele Fig 5 Sentiment Songs

Relationship between the emotions and the albums

We will find out how her emotion has evolved from the release of the first album and dominance of certain emotions in the albums.

 
grid.col = c("19" = "#E69F00", "21" = "#56B4E9", "25" = "#009E73")

album_emotion <- lyric_sentiment %>%
  filter(!sentiment %in% c("positive", "negative")) %>%
  count(sentiment, album) %>%
  group_by(album, sentiment) %>%
  summarise(sentiment_sum = sum(n)) %>%
  ungroup()

circos.clear()

#Set the gap size
circos.par(gap.after = c(rep(3, length(unique(album_emotion[[1]])) - 1), 15,
                         rep(3, length(unique(album_emotion[[2]])) - 1), 15))

chordDiagram(album_emotion, grid.col = grid.col, transparency = .2)
title("Relationship between emotion and albums")

The following chord diagram shows that her latest album, i.e., 25 is the most joyful one. Also, the scores for ‘joy’ has increased with the release of new albums. In terms of sadness, ‘21’ scores the highest.

Adele Fig 6 Album Emotions

Measuring valence of her albums

This is one my favourite audio features -- essentially valence can be described as a measure of the musical positiveness conveyed by a track. Tracks with high valence sound more positive (happy, cheerful, euphoric), while tracks with low valence sound more negative (sad, depressed, angry). We’ll be using Spotify API to extract the data and plot.

Note that the Spotify API pulled results for 34 tracks whereas Genius API gave 41 tracks. So, we cannot really compare the results of this plot with previous plot

 
library(spotifyr)
library(ggridges)

#Get client id and secret from here.
Sys.setenv(SPOTIFY_CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
Sys.setenv(SPOTIFY_CLIENT_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx')

adele_audio_feature <- get_artist_audio_features('Adele')

ggplot(adele_audio_feature, aes(x = valence, y = album_name, fill = ..x..)) + 
  geom_density_ridges_gradient(scale = 1) + 
  scale_fill_gradient(low = "#FFFFFF", high = "#56B4E9", guide=FALSE) + 
  xlim(0,1) +
  xlab("Albums")+ylab("Valence")+
  ggtitle("Valence of Adele's albums according to Spotify API")+
  theme_minimal()

According to this plot album 25 is the least positive album with average value of 0.28 whereas the other two albums are close to each other with average valence score of 0.41.

Adele Fig 7 Album Valence

Over to you

We uncovered some interesting insights from sentiment analysis of Adele’s songs, now it’s time for you perform analysis. Perhaps you could group the tracks by genre and try to see if there is anything unseen or apply topic modeling techniques. Don’t forget to post your interpretation!

Bio: Preetish Panda is a Marketing Manager at Prompt Cloud, a pioneer and global leader in Data-as-a-Service solutions. Preetish has a wide range of work experience, ranging from product engineering, business analysis to product and marketing management in top notch technology MNCs and high-growth startups.

Related: