Post

Song Sentiments App

A shiny app for sentiment analysis of song lyrics, using R and various sentiment libraries to visualize positive and negative words.

Song Sentiments App

Lyric Sentiments

Introduction

This might sound strange, but I think it is fascinating to look at the words we say and why we choose them. I think that the words we say/hear have an effect on us. I started to become curious at the different songs I was listening to, and I started to think of doing some basic sentiment analysis on them. As I started to look more into it, I decided that I would build a shiny app so that people could see a quick sentiment analysis of what they listen to. In the future I am hoping to build it out so that you can do it on albums, artists, and export the lyrics, but for now it is just the songs.

Here is a link to access the shiny app to look at your favorite songs:

https://jjfitz.shinyapps.io/lyrics/

Getting the Lyrics

After I built the app, I have been finding that there are R packages out there that already pull song lyrics, like geniusR. I might use those in the future for albums and artists. I pull the lyrics by scrapping the azlyrics.com website. Their Urls are structered by putting in the artist and the song name, and poof, you can get the lyrics.

Doing the Analysis

To do the analysis, I use a little bit of all the different sentiment libraries. I use the bing sentiments to get whether or not a word is negative or positive, afinn to get how negative or positive a word is, and nrc to look at the basic adjective that a word could belong too. The words in the nrc dataset does have words that have multiple adjectives associated with them, so keep that in mind. I pretty much count up all the words, and then make graphs out of them.

</div>

This post is licensed under CC BY 4.0 by the author.