November 2017
Beginner to intermediate
366 pages
7h 59m
English
We are going to leverage the sentimentr R package to learn the sentiments of the articles we have collected. Let's look at how to score using the sentiment function :
> sentiment.score <- sentiment(match.refined$TITLE)> head(sentiment.score) element_id sentence_id word_count sentiment1: 1 1 8 0.000000002: 2 1 11 0.000000003: 3 1 9 -0.133333334: 4 1 9 -0.083333335: 5 1 11 0.075377846: 6 1 9 0.00000000>
The sentiment function in sentimentr calculates a score between -1 and 1 for each of the articles. In fact, if a text has multiple sentences, it will calculate the score for each sentence. A score of -1 indicates that the sentence has a very negative polarity. A score of 1 means that the sentence is very positive. A score of ...
Read now
Unlock full access