O'Reilly logo

Haskell Data Analysis Cookbook by Nishant Shukla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required