banner

AI Model Developed to Detect Sarcasm in Social Media Text As Part of Sentiment Analysis

Sarcasm Sentiment Analysis: AI Model to Detect Sarcasm in Social Media

What is Sarcasm Sentiment Analysis (sarcastic sentiment detection)? Sentiment analysis of social media means just that – to use data to understand what people feel or think about your product, service, or even brand.

Since social media today is a crucial component of digital marketing, social media sentiment analysis means the collection and analysis of information in the posts or updates that people share about your company on social networks.

Know how AI model is developed to detect sarcasm in social media text as part of sentiment analysis (sarcasm detection in sentiment analysis).

Sarcasm detection in Social media sentiment analysis is important because it helps you understand exactly what people “think” of your brand. Questions that are answered include: what is the average consumer saying about your product? Are consumers happy or not with your customer service?


Sentiment analytics is emerging as a critical input in running a successful business. Want to know more about Express Analytics sentiment analysis service? Fill up this form and we’ll get in touch with you.


Of late, there’s been an increase in the use of artificial intelligence (AI) in this form of data analytics. Also, because of the advancement in natural language processing (NLP), data analysts can segmentize client feedback as: positive, negative, or neutral with natural language. NLP was largely being used in text analytics before being incorporated in digital voice interfaces such as Amazon Alexa.

nlp sarcasm detection

But the one challenge that analysts in sentiment analysis continue to face is how to detect sarcasm in such feedback. Sarcasm in social sciences may have been studied for a long but attempts to develop algorithms to automatically identify sarcasm in texts are fairly new.

Sarcasm detection represents a focused research field in NLP. Here, instead of detecting a positive or negative sentiment, the focus is to catch the sarcasm. This means understanding whether a piece of text like a social media post is sarcastic or not (sarcastic sentiment analysis).

This field has been wrought with challenges, especially since sarcasm, unlike other human emotions, is fairly hard to detect by a computer algorithm.

But now, a team of researchers from the University of Central Florida in the United States has developed what’s being touted as a “sarcasm detector”, taking a step forward in this field.

A report in neurosciencenews.com said the team’s developed a fairly accurate technique to detect sarcasm in social media posts. A paper on the proposed model by the research team was published in the journal “entropy” in March 2021.

Titled, “Interpretable Multi-Head Self-Attention Architecture for Sarcasm Detection in Social Media”, the authors, Ramya Akula and Ivan Garibay, researchers at the Complex Adaptive Systems Lab, Department of Computer Science, University of Central Florida, Orlando, have detailed their model in this paper.

Prospect new customers with lowest churn and highest LTV

The team said it had developed “an interpretable deep learning model using multi-head self-attention and gated recurrent units.” The module helps in identifying crucial sarcastic cue words from the input, and the recurrent units learn long-range dependencies between these cue words to better classify the input text.

Unlike categories in sentiment analysis like love (positive) or hate (negative) that are clearly defined, the borders of sarcasm are not. This means it is important that before beginning to attempt to detect sarcasm, one must define its boundaries for the model to work.

Here’s How They Did It

In its paper on “entropy”, the UFC team has said that the models trained using their approach were easily interpretable and enabled identifying sarcastic cues in the input text which contributed to the final classification score.

“We visualize the learned attention weights on a few sample input texts to showcase the effectiveness and interpretability of our model,” they wrote in the paper.

The team said the effectiveness of its approach was visible by “achieving state-of-the-art results on multiple datasets from social networking platforms and online media.” The models trained using their proposed approach were easily interpretable and could identify sarcastic cues in the input text which contributed to the final classification score.

Explaining its experimentation with their models in various scenarios, the team explained one of these approaches was to analyze the results of tweets. The tweets that contained sarcasm were identified and labeled by the human annotators solely based on the contents of the tweets.

These tweets were not dependent on prior conversational context. Tweets with no sarcasm or those that required prior conversational context were labeled as non-sarcastic. As a pre-processing step, URLs were removed from the tweets and all mentions are replaced with @user.

The team implemented its model in PyTorch, a deep-learning framework in Python (Sarcasm detection with Python). The approach it took to building the models was based on five components: data pre-processing, multi-head self-attention module, gated recurrent unit module, classification, and model interpretability.

What’s more, the experiments were conducted on multiple datasets from varied data sources and show significant improvement over the state-of-the-art models by all evaluation metrics.

Wrapping up the paper, the research team concluded that its model could indeed identify words in the input text that provided cues for sarcasm.

    Download the e Book

    Voice Of Customer Analytics

    [cf7mls_step cf7mls_step-1 "Continue" ""]

    Contact Information

    Please fill the details below

    [cf7mls_step cf7mls_step-2 "Back" "Step 2"]

    Build sentiment analysis models with Oyster

    Whatever be your business, you can leverage Express Analytics’ customer data platform Oyster to analyze your customer feedback. To know how to take that first step in the process, press on the tab below.

    Liked This Article?

    Gain more insights, case studies, information on our product, customer data platform

    Leave a comment