Streaming Twitter for real-time sentiment analysis

Twitter is flooded with content that arrives every second. A great way to start investigating real-time data is by examining tweets.

This recipe will show how to write code that reacts to tweets relating to a specific search query. We use an external web-endpoint to determine whether the sentiment is positive, neutral, or negative.

Getting ready

Install the twitter-conduit package:

$ cabal install twitter-conduit

For parsing JSON, let's use yocto:

$ cabal install yocto

How to do it…

Follow these steps to set up the Twitter credentials and begin coding:

  1. Create a new Twitter app by navigating to https://apps.twitter.com.
  2. Find the OAuth Consumer Key and OAuth Consumer Secret from this Twitter Application ...

Get Haskell Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.