An Effective Sarcasm Detection Approach Based on Sentimental Context and Individual Expression Habits


Sarcasm is common in social media, and people use it to express their opinions with stronger emotions indirectly. Although it belongs to a branch of sentiment analysis, traditional sentiment analysis methods cannot identify the rhetoric of irony as it requires a significant amount of background knowledge. Existing sarcasm detection approaches mainly focus on analyzing the text content of sarcasm using various natural language processing techniques. It is argued herein that the essential issue for detecting sarcasm is examining its context, including sentiments of texts that reply to the target text and user’s expression habit. A dual-channel convolutional neural network is proposed that analyzes not only the semantics of the target text, but also its sentimental context. In addition, SenticNet is used to add common sense to the long short-term memory (LSTM) model. The attention mechanism is then applied to take the user’s expression habits into account. A series of experiments were carried out on several public datasets, the results of which show that the proposed approach can significantly improve the performance of sarcasm detection tasks.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7


  1. 1.

    Kreuz R, Caucci G. Lexical influences on the perception of sarcasm. In Proceedings of the Workshop on computational approaches to Figurative Language. 2007. p. 1–4.

  2. 2.

    Bharti SK, Babu KS, Jena SK. Parsing-based sarcasm sentiment recognition in twitter data. In 2015 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM); 2015. p. 1373–1380. IEEE.

  3. 3.

    Amir S, Wallace BC, Lyu H, Carvalho P, Silva MJ. Modelling context with user embeddings for sarcasm detection in social media. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning; 2016. p. 167–177.

  4. 4.

    Ptáček T, Habernal I,  Hong J. Sarcasm detection on czech and english twitter. In Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers; 2014. p. 213–223.

  5. 5.

    Bamman D, Smith NA. Contextualized sarcasm detection on twitter. In Ninth international AAAI conference on web and social media. Citeseer; 2015 p. 574–577.

  6. 6.

    Khodak M, Saunshi N, Vodrahalli K. A large self-annotated corpus for sarcasm. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018);2018. p. 641–646.

  7. 7.

    Lukin S, Walker M. Really? well. apparently bootstrapping improves the performance of sarcasm and nastiness classifiers for online dialogue. In Proceedings of the Workshop on Language Analysis in Social Media; 2013 p. 30–40.

  8. 8.

    Riloff E, Qadir A, Surve P, De Silva L, Gilbert N, Huang R. Sarcasm as contrast between a positive sentiment and negative situation. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing; 2013. p. 704–714.

  9. 9.

    Rajadesingan A, Zafarani R, Liu H. Sarcasm detection on twitter: A behavioral modeling approach. In Proceedings of the eighth ACM international conference on web search and data mining; 2015. p. 97–106.

  10. 10.

    Reyes A, Rosso P, Veale T. A multidimensional approach for detecting irony in twitter. Lang Resour Eval. 2013;47(1):239–68.

    Article  Google Scholar 

  11. 11.

    Joshi A, Tripathi V, Bhattacharyya P, Carman MJ. Harnessing sequence labeling for sarcasm detection in dialogue from TV series ‘Friends’. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, Berlin, Germany. Association for Computational Linguistics; 2016. p. 146-155.

  12. 12.

    Mishra A, Kanojia D, Nagar S, Dey K, Bhattacharyya P. Harnessing cognitive features for sarcasm detection. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Berlin, Germany, Association for Computational Linguistics; 2016; p. 1095-1104.

  13. 13.

    Kim Y. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP); 2014. p. 1746–1751.

  14. 14.

    Hochreiter S, Schmidhuber J. Long short-term memory. Neural Comput. 1997;9(8):1735–80.

    Article  Google Scholar 

  15. 15.

    Ghosh A, Veale T. Fracking sarcasm using neural network. In Proceedings of the 7th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, San Diego, California, Association for Computational Linguistics; 2016 p. 161-169.

  16. 16.

    Cambria E. Affective computing and sentiment analysis. IEEE Intel Syst. 2016;31(2):102–7.

    Article  Google Scholar 

  17. 17.

    Wallace BC, Kertz L, Charniak E, et al. Humans require context to infer ironic intent (so computers probably do, too). In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers); 2014. p. 512–516.

  18. 18.

    Wallace BC, Charniak E, et al. Sparse, contextually informed models for irony detection: Exploiting user communities, entities and sentiment. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers); 2015. p. 1035–1044.

  19. 19.

    Ghosh D, Fabbri AR, Muresan S. The role of conversation context for sarcasm detection in online interactions. In Proceedings of the 18th Annual SIGdial Meeting on Discourse and Dialogue; 2017. p. 186–196.

  20. 20.

    Zhang M, Zhang Y, Fu G. Tweet sarcasm detection using deep neural network. In COLING; 2016. p. 2449–2460.

  21. 21.

    Ghosh A, Veale T. Magnets for sarcasm: Making sarcasm detection timely, contextual and very personal. In Empirical Methods in Natural Language Processing. 2017. p. 482–91.

  22. 22.

    Hazarika D, Poria S, Gorantla S, Cambria E, Zimmermann R, Mihalcea R. Cascade: Contextual sarcasm detection in online discussion forums. In Proceedings of the 27th International Conference on Computational Linguistics; 2018. p. 1837–1848.

  23. 23.

    Tsur O, Davidov D, Rappoport A. Icwsm-a great catchy name: Semi-supervised recognition of sarcastic sentences in online product reviews. In ICWSM, Washington, DC; 2010. p. 162-169.

  24. 24.

    Davidov D, Tsur O, Rappoport A. Semi-supervised recognition of sarcastic sentences in twitter and amazon. In Fourteenth Conference on Computational Natural Language Learning; 2010. p. 107–116.

  25. 25.

    Charalampakis B, Spathis D, Kouslis E, Kermanidis K. A comparison between semi-supervised and supervised text mining techniques on detecting irony in greek political tweets. Engineering Applications of Artificial Intelligence. 2016;51:50–7.

    Article  Google Scholar 

  26. 26.

    Balikas G, Moura S, Amini MR. Multitask learning for fine-grained twitter sentiment analysis. In Proceedings of the 40th international ACM SIGIR conference on research and development in information retrieval; 2017. p. 1005–1008.

  27. 27.

    Savini E, Caragea C. A multi-task learning approach to sarcasm detection (student abstract). Proceedings of the AAAI Conference on Artificial Intelligence. 2020;34:13907–8.

    Article  Google Scholar 

  28. 28.

    Chauhan DS, Dhanush S, Ekbal A, Bhattacharyya P. Sentiment and emotion help sarcasm? a multi-task learning framework for multi-modal sarcasm, sentiment and emotion analysis. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics; 2020. p. 4351–4360.

  29. 29.

    Majumder N, Poria S, Peng H, Chhaya N, Cambria E, Gelbukh A. Sentiment and sarcasm classification with multitask learning. IEEE Intelligent Systems. 2019;34(3):38–433.

    Article  Google Scholar 

  30. 30.

    Tang D, Wei F, Yang N, Zhou M, Liu T, Qin B. Learning sentiment-specific word embedding for twitter sentiment classification. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); 2014. p. 1555–1565.

  31. 31.

    Collobert R. Large scale machine learning. IDIAP: Technical report; 2004.

    Google Scholar 

  32. 32.

    Pennington J, Socher R, Manning C. Glove: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), Doha, Qatar. Association for Computational Linguistics; 2014. p. 1535-1543.

  33. 33.

    Le Q, Mikolov T. Distributed representations of sentences and documents. In International conference on machine learning; 2014. p. 1188–1196.

  34. 34.

    Collobert R, Weston J, Bottou L, Karlen M, Kavukcuoglu K, Kuksa P. Natural language processing (almost) from scratch. Journal of machine learning research. 2011;(12):2493–2537.

  35. 35.

    Mohammad S, Kiritchenko S, Zhu X. Nrc-canada: Building the state-of-the-art in sentiment analysis of tweets. In Second Joint Conference on Lexical and Computational Semantics (* SEM), Volume 2: Proceedings of the Seventh International Workshop on Semantic Evaluation (SemEval 2013); 2013. p. 321–327.

  36. 36.

    Cambria E, Poria S, Hazarika D, Kwok K. Senticnet 5: Discovering conceptual primitives for sentiment analysis by means of context embeddings. In Thirty-Second AAAI Conference on Artificial Intelligence; 2018. p. 1795–1802.

  37. 37.

    Cambria E, Fu J, Bisio F, Poria S. Affectivespace 2: Enabling affective intuition for concept-level sentiment analysis. In AAAI; 2015. p. 508–514.

  38. 38.

    Yang  B, Mitchell T. Leveraging knowledge bases in lstms for improving machine reading. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers); 2017. p. 1436–1446.

  39. 39.

    Cambria E, Li Y, Xing FZ, Poria S, Kwok K. Senticnet 6: Ensemble application of symbolic and subsymbolic ai for sentiment analysis. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management; 2020. p. 105–114.

Download references


This work is partially supported by the National Natural Science of Foundation of China (Grant Nos. 61902010 and 61671030), Beijing Excellent Talent Funding-Youth Project (No. 2018000020124G039), and Engineering Research Center of Intelligent Perception and Autonomous Control, Ministry of Education.

Author information



Corresponding author

Correspondence to Tong Li.

Ethics declarations

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Human and Animal Rights

This article does not contain any studies with human or animal subjects performed by any of the authors.

Informed Consent

Informed consent was not required as no human or animals were involved.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Du, Y., Li, T., Pathan, M.S. et al. An Effective Sarcasm Detection Approach Based on Sentimental Context and Individual Expression Habits. Cogn Comput (2021).

Download citation


  • Sarcasm detection
  • Convolutional neural network
  • Attention mechanism
  • Sentimental context
  • Expression habit