KDnuggets Home » News » 2011 » Oct » Software » Data mining with Ruby and Twitter  ( < Prev | 11:n24 | Next > )

Data mining with Ruby and Twitter


 
  
great examples of using Ruby to get Twitter user data, measure friend popularity, analyze followers by location, building a bar chart of tweet days, and more.


IBM.com, M. Tim Jones (independent author), Oct 4, 2011.

Twitter and APIs
Although the early web was about human-machine interaction, today's web is about machine-machine interaction, enabled using web services. These services exist for most popular websites-from various Google services to LinkedIn, Facebook, and Twitter. Web services create APIs through which external applications can query or manipulate content on websites.

Web services are implemented using a number of styles. Today, one of the most popular is Representational State Transfer, or REST. One implementation of REST is over the well-known HTTP protocol, allowing HTTP to exist as a medium for a RESTful architecture (using standard HTTP operations like GET, PUT, POST, and DELETE). The API for Twitter is developed as an abstraction over this medium. In this way, there's no knowledge of REST, HTTP, or data formats like XML or JSON, but instead an object-based interface that integrates cleanly into the Ruby language.

A quick tour of Ruby and Twitter

Tweet source Let's explore how you can use the Twitter API with Ruby. First, we need to get the necessary resources. If like me you're using Ubuntu Linux®, you use the apt framework.

To get the latest full Ruby distribution (approximately a 13MB download), use this command line:

$ sudo apt-get install ruby1.9.1-full
Next, grab the Twitter gem using the gem utility:
$ sudo gem install twitter

You now have everything you need for this step, so let's continue with a test of the Twitter wrapper. For this demonstration, use a shell called the Interactive Ruby Shell (IRB). This shell allows you to execute Ruby commands and experiment with the language in real time. IRB has a large number of capabilities, but we'll use it for simple experimentation.

Gregory Piatetsky-Shapiro:

This posts gives great examples of using Ruby to get Twitter user data, measure friend popularity, analyze followers by location, building a bar chart of tweet days, and more.

Read more.


 
Related
Data Mining Software

KDnuggets Home » News » 2011 » Oct » Software » Data mining with Ruby and Twitter  ( < Prev | 11:n24 | Next > )