Interpreting sentiment from phrases.
I came across http://tweetsentiments.com/ the other day, which is a service that tries to analyze the sentiment expressed in a phrase. The are using a technique called Support Vector machines. You can read about this implementation here http://www.csie.ntu.edu.tw/~cjlin/libsvm/
Note: Tweetsentiments.com has withdrawn free access to it’s API. This example has been removed from the example workbook for now – August 2012
I wondered if this could be applied to phrases outside the world of twitter – say to data collected in a spreadsheet from some other medium.
In a previous entry, I described how to add new entries to the rest-Excel library. Here’s another new library entry for tweetsentiments using their API. You can use this to get the data straight into Excel.
The input data is just a column of phrases that need their sentiment analyzed, and the output is positive, negative or neutral. Here are some random phrases I tried and got the results shown below.
The full code along with the other rest library examples can be downloaded in the cDataSet workbook, which is one of the projects on the ramblings website .
I’ll be adding more to this library from time to time as I come across useful APIS. If you would like to see one implemented, tell me about it at the ramblings forum.
Here are the library entries added so far.
“google patents” “twitter” “google books by isbn” “yahoo geocode” “imdb by title” “itunes movie” “google finance” “whatthetrend” “tweetsentiments”