I never forget a face, but in your case I’ll be glad to make an exception.
— Groucho Marx
Comedians dine on sarcasm — the ironic, mocking remarks that say one thing on the surface but cut much deeper.
Could a computer learn to detect this nuanced form of expression? Pushpak Bhattacharyya says they can — and he’s got the algorithms to prove it.
Bhattacharyya — director of the Indian Institute of Technology (IIT), Patna, and a professor at IIT, Bombay — has dedicated the past few years to using GPU-powered deep learning to spot sarcasm online.
“We found lots of tweets, especially in politics, to be sarcastic,” he said, in what may be the biggest understatement so far of 2018.
Sarcasm Research Is No Joke
Bhattacharyya’s not kidding when he says there are sound reasons to study sarcasm. Politicians, heads of state, businesses and even celebrities concerned with protecting their reputations monitor Twitter and other social media to assess public opinion.
But the methods they use for what’s known as “sentiment analysis” fall short when it comes to sarcasm, Bhattacharyya said.
“Sarcasm sheds light on how the human mind operates,” he said. So it’s no wonder it’s hard for computers to catch.
The word “sarcasm” comes from the Greek “sarkasmós,” meaning “tear flesh with teeth,” which pretty much describes its purpose: to ridicule or show contempt.
Sometimes snark comes with a clear signal — a tweet tagged “#sarcasm” or phrases like “as if” or “like you care.” Multiple exclamation marks, capital letters, emoticons and #LOL are other frequent flags for mockery.
More often, though, sarcasm isn’t obvious on the surface. Positive statements often hide negative meanings, Bhattacharyya said. He uses the phrase, “I love being ignored” to illustrate his point.
“When you look at the phrase, ‘I love being,’ you expect to see it followed by something positive like ‘rewarded’ or ‘appreciated,’” he said. “Then you see ‘ignored,’ and you understand that it’s sarcasm.”
As if That Wasn’t Hard Enough
Other times, knowing when a remark is tongue-in-cheek depends on understanding context or knowing something about the world. If someone says, “Phone battery lasts two hours. Awesome,” the AI would have to understand that a two-hour battery life isn’t a good thing.
That points to another problem. Nearly one-fifth of sarcastic tweets relate to numbers, but general sentiment analysis doesn’t pick it up, Bhattacharyya said.
Getting Serious About Sarcasm
When Bhattacharyya and his team — his students, several linguists and psychologists — dug further, they found the key to separating the praise from the put-downs.
“Incongruity is at the heart of sarcasm,” Bhattacharya said. “That’s our main contribution.”
Using the cuDNN-accelerated TensorFlow deep learning framework and our GeForce GTX 1080 Ti GPUs, the researchers trained neural networks to recognize that incongruity in datasets that included everything from tweets to movie reviews to dialogue from the 1990s TV sitcom,“Friends.”
In numerous studies, their algorithms could detect sarcasm more accurately than existing methods. That was especially true for tweets that include numbers; their accuracy rate of 80 percent more than triples previous efforts.
Bhattacharya worked with several of his doctoral students on this project: Aditya Joshi, Mark Carmen, Abhijit Mishra and Raksha Sharma.
Suite on Sarcasm
Building on earlier work, the researchers created a browser-based engine that detects sarcasm. Called Sarcasm Suite, it consists of two trained modules that researchers anywhere can use for snark spotting.
The modules detect sarcasm by evaluating people’s historical tweets, as well as identifying such textual elements as contradictory words and incongruous emotional expressions. To enrich their analysis, the researchers’ algorithms also incorporate factors like word intensity — the difference between “good” and “excellent,” for example — and use data from eye-tracking studies.
The tool also includes code for SarcasmBot, a chatbot that generates sarcasm on its own in response to a question. In one sample of its output, the user asks SarcasmBot, “What do you think of Greg?” The answer: “Well … I like Greg. The way I absolutely appreciate zero accountability people.”
So now, computers can be as sarcastic as the rest of us. That sounds just great.
For more information, see the following papers by Bhattacharya and his team: