Sentiment analysis is the science of assigning mood to pieces of text based on keywords and structure. On the web this kind of research is most commonly used in social media. In this project I decided to apply it to Tolkien's works to see I could find patterns. Since sentiment analysis is rather difficult I used an free API called Sentiment140 created by three Computer Science graduate students at Stanford University: Alec Go, Richa Bhayani, and Lei Huang. While their algorithm was originally designed for Twitter it can be applied to regular texts as well.
The analysis can be viewed in two modes, both showing the mood for each page in the book. To make patterns appear more clearly I used a moving average.