Bee Movie Sentiment Analysis

I was pretty bored last week. I mean, really, really bored. Bored enough that I decided to play with the Google Natural Language API and the bee movie script. I had originally learned about the Natural Language API at DevFest a few weeks ago and have wanted to test it out since then. This is the way I decided to try it out.

I downloaded the entire bee movie script. I did a few other little projects with the script first, but eventually parsed the script into lines to be utilized by the API. The script ended up being roughly 1300 lines long. The line parsed script I used is available as a gist.

Once I had the lines of the movie, I decided to try to get the overall sentiment of the movie graphed. Since at some points the movie is darker than other points, I figured I would be able to find these moments in the sentiment graph. This is what I wanted to find out.

Once I ran all of the lines through the API, and recorded the sentiments, I created a graph of the running sum of the sentiment. The API returns a value from -1.0 to 1.0 where -1.0 is a negative sentiment, and 1.0 is a positive sentiment. Graphing the sum provided a cool visualization of the overall sentiment of the film.

This is the graph that was produced:

Bee Movie Sentiment Analysis

I was intrigued by the result because I could clearly see points in the movie where the sentiment was negative. Around the 70% mark of the movie the sentiment was decidedly negative.

Overall this was a pointless exercise in using the API, but it showed the power of sentiment analysis. I'm happy with the data and look forward to using it for more of my pointless projects!