A web front end for R Twitter sentiment analysis
Python R
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Blue Bird README


Blue Bird is a web interface for performing simple sentiment analysis of twitter. It follows Jeffrey Breen’s simple method of assigning each tweet a single integer representing each tweets sentiment based off the presence of positive and negative words. It then produces a stacked histogram of all the tweets for a given query.


Blue Bird’s sentiment analysis R code was originally written by Jeffrey Breen. The Apache licensed code is available here. The sentiment lexicon was originally compiled by Bing Liu and Minqing Hu and is available for download here. It is included in this repository by permission of the author.

Installation and Setup

  1. Clone this repository or click the download button in the upper right hand corner.
  2. Install all dependencies listed below.
  3. Open settings and set the host and port to the desired values.

    Default: localhost:8348

  4. Run it the script as ./bluebird it will start out as a background process.
  5. Visit host:port i.e. localhost:8348.
  6. Enter a query and hit analyze. (There may be a long delay, the latency for fetching from twitter is very high)


Usage is relatively simple visit the webpage and enter a query then hit analyze and Blue Bird will search twitter, analyze the results and provide a stacked histogram of the results. Visit here (or read the source) to get a nice description of the method used to produce the charts before you start making conclusions. That’s all you need to know to get started.

  • How do I make it display “Python” and “Ruby” when I search “#python, #ruby”?

    Under show additional options there is a Labels option, simply type a comma separated list in the same order as above and the labels will be used in place of the search. In this case “Python, Ruby”.

  • How do I augment the word lists being used to judge the sentiment of a tweet?

    Under show additional options there is a positive and a negative words option. In their respective boxes, type a comma separated list of the words you’d like to augment the words list with and click analyze and you’ll get the results.

Adding Additional Services

By default, Blue Bird comes with one service, the tweepy interface to twitter. However, Blue Bird is written to allow the use of multiple services.

What is a service? As far as bluebird is concerned, a service as any python function that takes a single argument, the query, and returns an iterable of strings. Each string in the iterable is scored individually and the scores of all strings in the iterable are used to generate a histogram.

How do I write one? Open up services.py and look at the tweepy service for an example. The following is a skeleton for a service.

def myService(query):
    "My service, it's awesome!"
    # Magic happens: put your service code here
    return ["I'm happy, I wrote my first service", "I'm upset :(",
            query] # replace with any iterable of strings (iterables
            # include lists, tuples and more)

Once you’ve written you’re service, go to the bottom of services.py and add it to the SERVICES variable:

SERVICES = [("Tweepy", getTweetsText), ("My Service", myService)]

Now restart Blue Bird and your service should be available.


Python (tested in 2.7)

Can be installed with “easy-install name”

  • bottle
  • rpy2
  • numpy
  • tweepy

R (tested with 2.13.1)

Can be install in R with “install.packages(‘name’)”

  • plyr
  • ggplot2
  • stringr


  • If you get the following import error:
    ImportError: libR.so: cannot open shared object file: No such file or directory

    Then you must add the following to your .bashrc

    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/R/lib

    /usr/lib/R/lib may be a different path depending on your R install. It should be replaced with the directory that contains: libR.so

  • Bug when nothing returned in search. Defaults to one neutral item in the histogram to prevent R from raising an error.