AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Computers can understand sarcasm

I have too often heard people claim the opposite, so I decided to put an end to it and program a computer to understand sarcasm in a day. I explain how I did so in a blog post, and although I don’t visually demonstrate the program, I believe the simplicity of the explanation should remove all doubt whether this is possible. I only wish I had found some more convincing projects than the knock-knock joke detector to put forward.

I do not intend to expand on this function, as I rarely say sarcastic things to my computer other than “Great” and “Thanks a bunch”. Perhaps you will find use in it to program your own sarcasm detector. This is somewhat related to a previous thread on computational humour.


  [ # 1 ]

Very good text.
At first, I was a little concerned about your statement since I, myself, use a lot of sarcasm and have witnessed that most people are unable to understand it.
So, I thought, if humans are not smart enough to understand sarcasm, how could a machine be?
You explained why, at least to some extent: just apply a logical pattern to what has been ‘said’ and the most obvious sarcasm would be easily perceived.
As a matter of fact, most people are not able to do that.
“...  even if computers could master sarcasm, humans never will.”
On the other hand…
A care to be taken, if one decides to program a sarcastic bot, is the human reaction. Usually, anger (and I know what I’m talking about).
This has not to do with being told some ‘lie’ but, I believe, resides in the fact that the ‘he/she/it was being sarcastic’ realization comes too late for the interlocutor to avoid conceding his agreement to what, most of the time, turns out to be a stupid idea.
“Don’t you just hate it – when you get a raise?”


  [ # 2 ]

Could well be. That’s why I’ve only made a sarcasm detector and not a sarcasm generator smile
Spoken sarcasm is often mistaken due to a dead-serious tone of voice, a variable not present in written sarcasm. If Iron Man’s Jarvis had been using monotone text-to-speech software I doubt people would have noticed as well as when he’s audibly rolling his eyes on the vowels.


  [ # 3 ]

There have been times in my years of visiting and chatting with various chatbots that I’ve also been able to read some of those bots’ conversational log files.
Often times, when a user says something rude, snarky or sarcastic, the bot will offer its own sometimes hostile reply.

While this can certainly be amusing or have humorous overtones, it might wear thin for the individuals among us who do not possess a sense of humor or may not appreciate punctual sarcasm.

Scripted bots can match patterns and usher them forth as needed but how would a self-learning bot handle sarcasm? It would have to “understand” the context not only of words being entered but of the entire sentence. Not really a trivial task.

User: You dress like a lumberjack!
Bot: Excuse me but we were not discussing your mother!!



  [ # 4 ]

“You dress like a lumberjack!”
1. Recognise linguistic form of comparison.
2. Look up how a lumberjack dresses: checkered/manly/badly -> Recognise as indirect insult
3. Apply “yo momma *insert synonyms*” joke template.

The thing is this sort of thing would take a huge knowledge database that I don’t have/won’t learn soon, that includes the dress style of lumberjacks. And it’s not something I would do, really. My program is too smartass already by taking everything literally and seriously.


  [ # 5 ]

If Morti had a response for that input (he does not), he would probably respond with “I’m sure all the lumberjacks are jealous!”. The trick here is not just in detecting sarcasm, but in judging whether to respond in kind or not, and that’s a long way off for pretty much all chatbots, these days.


  [ # 6 ]

Yeah…it’s all fun and games until a chatbot gets hurt! or maybe gets its feelings hurt. wink


  [ # 7 ]

This got me to thinking that I need to either create a category (or several) to convert from singular (e.g. lumberjack) to plural (lumberjacks) and back, which isn’t as easy as it sounds. It may be better to use Program O’s custom tag support to support <singular> and <plural> tags, which would allow much greater flexibility with the conversion process. After all, the rules for such conversions in English are rather convoluted, depending on the word. smile


  [ # 8 ]
Dave Morton - Aug 25, 2016:

judging whether to respond in kind or not, and that’s a long way off for pretty much all chatbots, these days.

Judging, or deciding. Humans don’t exactly do a whole psycho-analysis either before reacting to an insult. There is some fascinating research on telling personality from text, and there are all sorts of user reactions you could monitor to categorise their sense of humour and mood, but on that point I’m going to have to agree that current chatbot systems aren’t designed to incorporate that many variables, and it would take me months all the same. Mixing humour with insults sounds like a bad idea anyway.

De-pluralisation is quite a fuss indeed. Here’s a decent site on the rules:
Mind you, the -ves vs -fes rule is most inconsistent, though I recall making a sub-rule for -lves and -ives that had rare to no exceptions.


  [ # 9 ]

“Mixing humour with insults sounds like a bad idea anyway.”

I agree, even though that is the underlying premise behind many chatbot retorts and those vast numbers of “Yo Mamma” responses, I find them equally unnecessary and without charm.

The “turning the tables” wordplay on the user is, however, a clever method to allow the bot an acceptable reply in some instances while also injecting a touch of humor, if the user is inclined to play along.

It might be best to describe the bot’s personality before hand as either a mischievous, wiseguy, an ordinary assistant or an eccentric wizard. This sets the tone for discussion in a lot of circumstances but certainly does not preclude some miscreant from jerking the chain of the bot’s sanity or reason. In these cases most bots have routines for handling rough, vulgar or simply annoying behavior. I have seen some bots that provide a couple of warnings then completely shut down leaving the user in the dark! <insert nodding smiley face here>.


  [ # 10 ]

Mine just keeps insisting on an apology when a certain level of insult has been crossed, as a discouragement and lesson in good manners. I put it in there after reading transcripts of the Loebner Prize rolleyes. Luckily detecting insults is the same as detecting compliments with bad words, and I do indulge compliments.


  login or register to react