In my last post I have demonstrated how R can be used to scrape information from the internet. In particular I have scraped the archives of DailyHaiku for their poetic treasures.
Today I want to show how to perform a sentiment analysis on those Haiku. Sentiment analysis is a very popular sub-area of natural language processing that is used to systematically identify, extract, and quantify affective states from text. In the most basic form it tells you whether a statement in form of a word, sentence, paragraph, or even book is positive or negative.
For the demonstration I will use R and the tidytext package, because I just love how tidytext integrates into the R tidyverse. However, several alternative packages for and other programming languages exist. E.g., if you are into python you should really check out the Natural Language Toolkit.