Sentimental AI

Dec 27, 2018 by Prateek

It is fun to watch Artificial Intelligence fail. Their logical innocence (stupidity?) can be hilarious. One of my first encounters with AI was with ELIZA — the 1966 NLP program — using the doctor package on emacs. I would spend hours making it say stupid things, and while we’ve come a long way with NLP since Eliza, computers still haven’t lost their innocence — just ask Siri if they know Eliza.

The wink-sentiment package is no exception to this. Built on top of our tokenizer and AFINN it is not only able to detect sentiment but is also able to handle negation:

In the examples above gray is a neutral sentiment, blue and its deeper shades are for negative sentiment, and pink and it's brighter shades are used to show positive sentiment.

While it can handle negation and two word phrases it is no match for sarcasm, unless of course you use the right emoji: 😝

But human sentiments aren’t limited to tokenized words or emojis, they have layers of meaning. Testing the package with songs and poetry really reveals the depth of the problem we’re trying to solve for. It is a tall order for any sentiment analysis technique.

Here are a few lines from the poem Figures in a Landscape by Doppler by Ranjit Hoskote. Notice how it only catches the positive sentiment at the end:

Next we have the song All Blues written by Oscar Brown. It initially captures the two meanings of "blue", and finally ends at an appropriate deep blue:

Seeing AI fumble, and sometimes even fail, is the how we learn more about it. It helps us decide the direction of our work and look at new ways of solving these problems. Stay tuned for our next experiment where we compare different approaches to sentiment analysis.

The GIFs above were made using our testing tool Sentimental, do give it a try.


Packages


sentiment
Accurate and fast sentiment scoring of phrases with emoticons & emojis.
Github · Documentation

tokenizer
Multilingual tokenizer that automatically tags each token with its type such as word, email, time or hashtag.
Github · Documentation



Recent posts

Naive Bayes gets Sentimental

Sentimental AI

NLP in Agriculture

A more permissive license




Sign up for updates!

Get occasional updates from our team about new tools and guides.