Sentiment Analysis using TweetSentiments.com API

The TweetSentiments.com API is now available for developers who are interested in Twitter related sentiment analysis.

Support Vector Machines

TweetSentiments.com sentiment analysis is based on a machine learning method called Support Vector Machines(SVM). SVM is one of the most efficient supervised learning algorithms. We are using LIBSVM – a popular implementation of SVM developed at Taiwan National University.

SVM is very computational intensive and LIBSVM is implemented in C++ for performance. For Ruby and Rails, a gem called libsvm-ruby-swig is available on Github; you can install it by running “gem install libsvm-ruby-swig”. Currently, it only runs on the Linux platform.

For large scale text classification, LIBLINEAR is much more efficient. You can use the liblinear-ruby-swig gem with Ruby and Rails.

Currently three API calls are available:

Sentiment on tweets http://data.tweetsentiments.com:8080/api/analyze.json?q=<text to analyze>
Sentiment on topics http://data.tweetsentiments.com:8080/api/search.json?topic=<topic to analyze>
Sentiment on users http://data.tweetsentiments.com:8080/api/search.json?user=<twitter user to analyze>

The sentiment analysis API is available either as web service (at http://data.tweetsentiments.com:8080) or as a standalone app that can be installed behind the firewall.

To try out the API calls, run the following sample code in irb:

We will be working on improving sentiment analysis accuracy, performance, and also adding additional features. Feel free to contact us for suggestions, feature requests, and bug reports.