lunes, 3 de abril de 2017

Sentiment Analysis - Adele's Songs

Text Mining is the process of deriving new information from texts. In this case we will analyze the choirs of some of the most famous songs of Adele such as: Rolling In the Deep, Someone Like You, Hello, etc.

From the point of view of Text Mining, Sentiment Analysis is a task of mass classification of texts or documents automatically, depending on the positive or negative connotation of the language occupied. It is important to mention that these treatments are usually based on statistical and association relationships, not on linguistic analysis.

The analysis of feeling tries to determine the attitude of an interlocutor or a writer with respect to some subject. The attitude can be his judgment or evaluation, affective state (that is, the emotional state of the author at the time of writing), or the emotional communicative intention (ie, the emotional effect that the author tries to cause in the reader).

In our case, we will analyze what kind of feeling we are transmitted by Adele's songs that in addition to voice and rhythm, which feelings hide their lyrics.


We will use R, load some libraries:

The sentiment analysis algorithm used here is based on the NRC Word-Emotion Association Lexicon of Saif Mohammad and Peter Turney. The idea here is that these researchers have built a dictionary/lexicon containing lots of words with associated scores for eight different emotions and two sentiments (positive/negative). Each individual word in the lexicon will have a “yes” (one) or “no” (zero) for the emotions and sentiments, and we can calculate the total sentiment of a sentence by adding up the individual sentiments for each word in the sentence. Not every English word is in the lexicon because many English words are pretty neutral.

Rolling In The Deep
We could have had it all…
Hello from the other side…
Someone like you
Never mind, I'll find someone like you…
When we were young
Let me photograph you in this light…
Send My Love
Send my love to your new lover…

We load the data
songs <- read.csv("./songs.csv", stringsAsFactors = FALSE)
get_nrc_sentiment("I'm so excited")
 anger anticipation disgust fear joy sadness surprise trust negative positive
0             1       0    0   1       0        1     1        0       1
As we see, it analyzes the sentence and shows us the feelings it contains. And analyze the sentence as positive.
mySentiment <- get_nrc_sentiment(songs$song_lyric)
  anger anticipation disgust fear joy sadness surprise trust negative positive
1     0            0       0    0   0       1        0     0        1        0
2     0            0       0    0   0       0        0     0        0        0
3     0            0       0    0   1       1        0     0        2        1
4     0            1       0    1   0       1        0     0        1        0
5     1            2       1    1   3       1        1     2        1        3
Now, we can make a graph with these values, some details are more advanced, but we can read the graph.
songs <- cbind(songs, mySentiment)
sentimentTotals <- data.frame(colSums(songs[,c(6:12)]))
names(sentimentTotals) <- "count"
sentimentTotals <- cbind("sentiment" = rownames(sentimentTotals), sentimentTotals)
rownames(sentimentTotals) <- NULL
ggplot(data = sentimentTotals, aes(x = sentiment, y = count)) +
        geom_bar(aes(fill = sentiment), stat = "identity") +
        theme(legend.position = "none") +
        xlab("Sentiment") + ylab("Total Count") + ggtitle("Total Sentiment Score for Top 5 Adele Songs")


We can mention that joy and sadness, followed by hope are the feelings that predominate and excite the fans.

Follow us,

Here the video:


No hay comentarios:

Publicar un comentario