5 min to read
NLP and Sarcasm: What's the Deal?
Sarcasm is incredibly hard for chatbots and NLP applications. Here, we'll take a look at why.
Sarcasm or Not?
As humans, you and I can look at these two chats and determine that in the first the person appears to be sincere while in the other comes off sarcastic and cold simply due to the way it was punctuated.
This may seem fairly obvious. Yet for chatbots and natural language processing algorithms, these two responses tend to appear identical. When taken in the literal sense, there’s no reason to assume that both people had the same reaction. Removing our understanding of social cues hinders our ability to discern the true intention of the message.
What Makes Sarcasm Difficult for Machines?
Needless to say, sarcasm is hard! Even people struggle with it. How many times, either over text or in person, have you made a social blunder by failing to recognize when someone was being sarcastic with you? I know I have and it’s embarrassing.
Take for example a saying of the internet, Poe’s Law. In short, the idea is that without a clear indicator that the author’s intent is a sarcastic one, they can write down any extreme idea or belief that will result in some readers assuming that it is 100% serious.
This is because sarcasm is extremely contextual. It relies on social cues and cultural backgrounds. Someone from the UK can make a comment that they feel is obviously sarcastic and many people from around the world will not pick up on these cues that are blatant indicators of sarcasm to the speaker.
With AI and chatbots, this is no different. In order for these types of technologies to understand sarcasm, they need to understand contextual clues. On top of that, they must do so without a lot of the nonverbal indications. Things like vocal tonality and body language play crucial roles in determining sarcasm. Virtual assistant devices like Alexa and Google Home can benefit (and likely will in the future) from the way in which people say things. But with just plain text, these nonverbal aspects are entirely absent.
This is just part of a bigger issue that AI has when it comes to natural language: Machines take everything literally. Idioms like “spill the beans” are completely lost on many systems. Even something as simple as a negation (ex: tell me something not happy) are oftentimes processed as the opposite of what was intended, resulting in fairly awkward conversations between bots and humans.
Clearly, for any interesting, intelligent system a solution to the problem of sarcasm is needed!
Why Do We Even Want Bots to Understand Sarcasm?
There are many immediate business applications for sarcasm detection in production-grade, natural language processing systems and chatbots. For instance, when someone is complaining about a product, they might be fairly sarcastic about it. If a system cannot detect that, then a company may completely miss an issue a customer is having, or worse, highlight a sarcastic review as a positive one! Sarcasm detection can also be used in this fashion to build better recommendation engines, filtering when an opinion is actually implying the opposite of what it literally states.
Online harassment commonly occurs in the form of sarcasm. Using the surrounding comments and/or posts, a system could identify and proactively flag statements that are violating policies surrounding things like hate speech and harassment. This can help social media companies to build better online communities.
Furthermore, any chatbot or virtual system can benefit from being able to understand when a person is being sarcastic with them. A chatbot that gives a bad answer and receives the response “just what I needed, something completely irrelevant” and then responds with “you’re welcome!” comes off as stupid and a bit irritating. If a chatbot can detect the sarcastic tone, they can react more intelligently and can have more natural conversations with people.
Beyond business facing applications, sarcasm detection can help individuals who have autism or Asperger’s syndrome who may have a bit more difficulty identifying when someone is being sarcastic with them. A tool that can assist people in navigating human interactions and be more effective communicators in the process would be very cool and very powerful.
Current Solutions to the Sarcasm Problem
Sarcasm detection has largely eluded the natural language processing community. In 2016, a 10-year survey of sarcasm detection techniques was published. The gist? Sarcasm detection is far from being solved. They highlighted interesting directions to explore in the realm of better pattern matching and better incorporation of context beyond the target text in question.
Another interesting solution, dubbed Sarcasm SIGN, approaches the task as a monolingual machine translation task. Using machine translation techniques, it uses sentiments of key words to translate them into clusters. From there, a prediction is made if really, given the context, the opposite cluster is being implied. Though far from perfect, it is one of the more unique approaches to the problem.
Finally, another really cool approach comes out of MIT: DeepEmoji. The researchers responsible for DeepEmoji focused on the goal of identifying emotions in tweets. What they ended up finding was that emojis are significant indicators of emotion (thus the name). Sarcasm is one of the emotions it was tasked with identifying and currently it has an 82% success rate to the average human ability of 76%.
A Critical Component to a Silent Revolution
Sarcasm clearly can cause havoc on chatbots. It creates skews in datasets that obscures the true meaning and sentiment behind statements. Overfitting on literal meanings of statements results in systems that completely ignore irritated and sarcastic users. It creates social blunders that we’d like to avoid when creating systems that will interact with real users.
Though we are making progress towards being able to understand and detect sarcasm, systems are still very far from being able to do so. And by Poe’s Law, we can assume that if a user doesn’t give us enough context or signaling, we may never create systems that “crack” human sarcasm. For now, we can take simple solace in the fact that if machines can’t understand our sarcasm, at least they can’t get sarcastic with us.
If you enjoyed this blog, let me know! Recently, I’ve taken up freelance content writing and would love to write a blog or article for you, especially if it’s about NLP, AI, machine learning, or data science.
If you’re interested, let me know here: Fiverr