Sentiment API

Understanding if a text is positive or negative is easy for humans, but a lot harder for computers. We can “read between the lines”, get jokes and identify irony. Computers aren’t quite there yet but the gap is quickly closing in.

Our contribution is a free Sentiment API that can help users to do market research, brand surveys and see trends around their campaigns. The API will not only reveal if a document is positive or negative, it will also indicate how positive or negative it is.


You can try it directly here and get your own API by signing up.

Dataset credits

The Amazon reviews dataset have been collected and formatted by Mark Dredze at the John Hopkins University. Many thanks for sharing!

Mattias Östmar has manually built the Mood classifier with his sweat and tears, thanks for letting me use it for this classifier. A big hug! (he really likes hugs)

Techy description

The API is available in XML and REST, with XML/JSON responses.

The sentiment classifier is based on circa 40000 Amazon reviews from 25 different product genres. Documents from the genres are merged into one classifier with two classes, positive and negative.

On top of this I’ve integrated the Mood classifier, my hope is that it will help to capture some more emotional traits in texts, also it complements the Amazon training data since it is taken from another domain (obvious difference is that it contains swear words).

The expected accuracy is about 78% (macro-precision: 77% and macro-recall: 77%) running 10-fold cross validation.

Image by Anna Gathu.