A hybrid content and context-based method for sarcasm detection

Document Type : Original Article


1 Department of Computer Engineering, Ferdowsi University of Mashhad, Mashhad, Iran.

2 Computer Engineering, School of Engineering, University of Guelph, Canada.


With the growing use of social media, figurative language has become very common on social media platforms. Given its complexity, figurative language can confuse natural language processing systems and lead to incorrect results. To address this issue, researchers have developed methods to detect humor, jokes, irony, and especially sarcasm. To date, most studies have used deep learning methods to identify sarcasm. Some studies have also incorporated context such as previous posts or conversations to improve the accuracy of sarcasm detection. But the context that can be highly effective in detecting the sarcasm of posts is the characteristics of the writer of the posts. So, the present paper aims to develop a hybrid approach that combines content and context features to better identify sarcastic posts. i.e., this study additionally proposes a deep learning method to model the content of tweets and suggests a multi-dimensional method that considers the user’s writing style and personality traits as context features. Several experiments were used to evaluate the effectiveness of the proposed method. The results indicated that the proposed method outperformed baseline methods in sarcasm detection.


Main Subjects

[1]    D. G. Maynard and M. A. Greenwood, “Who cares about sarcastic tweets? investigating the impact of sarcasm on sentiment analysis,” in Lrec 2014 proceedings, ELRA, 2014.
[2]    A. Joshi, P. Bhattacharyya, and M. J. Carman, “Automatic sarcasm detection: A survey,” ACM Comput. Surv. CSUR, vol. 50, no. 5, pp. 1–22, 2017.
[3]    Silviu Oprea and Walid Magdy. isarcasm: A dataset of intended sarcasm. Silviu Oprea, Walid Magdy, isarcasm: A dataset of intended sarcasm, 2019, arXiv preprint arXiv:1911.03123, 2019.
[4]    A. Kumar, V. T. Narapareddy, V. A. Srikanth, A. Malapati, and L. B. M. Neti, “Sarcasm detection using multi-head attention based bidirectional LSTM,” Ieee Access, vol. 8, pp. 6388–6397, 2020.
[5]    A. Reyes, P. Rosso, and D. Buscaldi, “From humor recognition to irony detection: The figurative language of social media,” Data Knowl. Eng., vol. 74, pp. 1–12, 2012.
[6]    A. Reyes, P. Rosso, and T. Veale, “A multidimensional approach for detecting irony in twitter,” Lang. Resour. Eval., vol. 47, pp. 239–268, 2013.
[7]    S. K. Bharti, K. S. Babu, and S. K. Jena, “Parsing-based sarcasm sentiment recognition in twitter data,” in Proceedings of the 2015 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining 2015, pp. 1373–1380, 2015.
[8]    E. Riloff, A. Qadir, P. Surve, L. De Silva, N. Gilbert, and R. Huang, “Sarcasm as contrast between a positive sentiment and negative situation,” in Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 704–714, 2013.
[9]    R. Akula and I. Garibay, “Interpretable multi-head self-attention architecture for sarcasm detection in social media,” Entropy, vol. 23, no. 4, p. 394, 2021.
[10] P. Carvalho, L. Sarmento, M. J. Silva, and E. De Oliveira, “Clues for detecting irony in user-generated contents: oh...‼ it’s" so easy";-,” in Proceedings of the 1st international CIKM workshop on Topic-sentiment analysis for mass opinion, pp. 53–56, 2009.
[11] R. González-Ibánez, S. Muresan, and N. Wacholder, “Identifying sarcasm in twitter: a closer look,” in Proceedings of the 49th annual meeting of the association for computational linguistics: human language technologies, pp. 581–586, 2011.
[12] O. Tsur, D. Davidov, and A. Rappoport, “ICWSM—a great catchy name: Semi-supervised recognition of sarcastic sentences in online product reviews,” in Proceedings of the International AAAI Conference on Web and Social Media, pp. 162–169, 2010.
[13] D. Davidov, O. Tsur, and A. Rappoport, “Semi-supervised recognition of sarcasm in Twitter and Amazon,” in Proceedings of the fourteenth conference on computational natural language learning, pp. 107–116, 2010.
[14] B. C. Wallace and E. Charniak, “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), pp. 1035–1044, 2015.
[15] S. Poria, E. Cambria, D. Hazarika, and P. Vij, “A deeper look into sarcastic tweets using deep convolutional neural networks,” ArXiv Prepr. ArXiv161008815, 2016.
[16] A. Rajadesingan, R. Zafarani, and H. Liu, “Sarcasm detection on twitter: A behavioral modeling approach,” in Proceedings of the eighth ACM international conference on web search and data mining, pp. 97–106, 2015.
[17] M. Zhang, Y. Zhang, and G. Fu, “Tweet sarcasm detection using deep neural network,” in Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: technical papers, pp. 2449–2460, 2016.
[18] S. Amir, B. C. Wallace, H. Lyu, and P. C. M. J. Silva, “Modelling context with user embeddings for sarcasm detection in social media,” ArXiv Prepr. ArXiv160700976, 2016.
[19] A. Ghosh and T. Veale, “Fracking sarcasm using neural network,” in Proceedings of the 7th workshop on computational approaches to subjectivity, sentiment and social media analysis, pp. 161–169, 2016.
[20] L. Liu, D. Zhang, and W. Song, “Modeling sentiment association in discourse for humor recognition,” in Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 586–591, 2018.
[21] A. Vaswani et al., “Attention is all you need,” Adv. Neural Inf. Process. Syst., vol. 30, 2017.
[22] T. Mikolov, K. Chen, G. Corrado, and J. Dean, “Efficient estimation of word representations in vector space,” ArXiv Prepr. ArXiv13013781, 2013.
[23] R.-A. Potamias, G. Siolas, and A. Stafylopatis, “A robust deep ensemble classifier for figurative language detection,” in Engineering Applications of Neural Networks: 20th International Conference, EANN 2019, Xersonisos, Crete, Greece, May 24-26, 2019, Proceedings 20, Springer, pp. 164–175, 2019.
[24] L. Kumar, A. Somani, and P. Bhattacharyya, “‘ Having 2 hours to write a paper is fun!’: Detecting Sarcasm in Numerical Portions of Text,” ArXiv Prepr. ArXiv170901950, 2017.
[25] Y.-H. Huang, H.-H. Huang, and H.-H. Chen, “Irony detection with attentive recurrent neural networks,” in Advances in Information Retrieval: 39th European Conference on IR Research, ECIR 2017, Aberdeen, UK, April 8-13, 2017, Proceedings 39, Springer, pp. 534–540, 2017.
[26 38]   S. Zhang, X. Zhang, J. Chan, and P. Rosso, “Irony detection via sentiment-based transfer learning,” Inf. Process. Manag., vol. 56, no. 5, pp. 1633–1644, 2019.
[27] Tay, Y., Luu, A. T., Hui, S. C., & Su, J. (2018, July). Reasoning with Sarcasm by Reading In-Between. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (pp. 1010-1020).
[28] A. Ghosh and T. Veale, “Magnets for sarcasm: Making sarcasm detection timely, contextual and very personal,” in Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 482–491, 2017.
[29] T. Xiong, P. Zhang, H. Zhu, and Y. Yang, “Sarcasm detection with self-matching networks and low-rank bilinear pooling,” in The world wide web conference, pp. 2115–2124, 2019.
[30] A. Kumar and G. Garg, “Empirical study of shallow and deep learning models for sarcasm detection using context in benchmark datasets,” J. Ambient Intell. Humaniz. Comput., pp. 1–16, 2019.
[31] A. Kumar, S. R. Sangwan, A. Arora, A. Nayyar, and M. Abdel-Basset, “Sarcasm detection using soft attention-based bidirectional long short-term memory model with convolution network,” IEEE Access, vol. 7, pp. 23319–23328, 2019.
[32] A. Onan and M. A. Toçoğlu, “A term weighted neural language model and stacked bidirectional LSTM based framework for sarcasm identification,” IEEE Access, vol. 9, pp. 7701–7722, 2021.
[33] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, “Bert: Pre-training of deep bidirectional transformers for language understanding,” ArXiv Prepr. ArXiv181004805, 2018.
[34] Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. R. Salakhutdinov, and Q. V. Le, “Xlnet: Generalized autoregressive pretraining for language understanding,” Adv. Neural Inf. Process. Syst., vol. 32, 2019.
[35] T. Brown et al., “Language models are few-shot learners,” Adv. Neural Inf. Process. Syst., vol. 33, pp. 1877–1901, 2020.
[36 ] N. Babanejad, H. Davoudi, A. An, and M. Papagelis, “Affective and contextual embedding for sarcasm detection,” in Proceedings of the 28th international conference on computational linguistics, pp. 225–243, 2020.
[37] A. Kumar, V. T. Narapareddy, P. Gupta, V. A. Srikanth, L. B. M. Neti, and A. Malapati, “Adversarial and auxiliary features-aware bert for sarcasm detection,” in Proceedings of the 3rd ACM India Joint International Conference on Data Science & Management of Data (8th ACM IKDD CODS & 26th COMAD), pp. 163–170, 2021.
[38] B. Liang et al., “Multi-modal sarcasm detection via cross-modal graph convolutional network,” in Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Association for Computational Linguistics, pp. 1767–1777, 2022.
[39] A. Dosovitskiy et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” ArXiv Prepr. ArXiv201011929, 2020.
[40] E. Savini and C. Caragea, “Intermediate-task transfer learning with BERT for sarcasm detection,” Mathematics, vol. 10, no. 5, p. 844, 2022.
[41] Z. Wen et al., “Sememe knowledge and auxiliary information enhanced approach for sarcasm detection,” Inf. Process. Manag., vol. 59, no. 3, p. 102883, 2022.
[42] M. Yuan, Z. Mengyuan, L. Jiang, Y. Mo, and X. Shi, “stce at semeval-2022 task 6: Sarcasm detection in english tweets,” in Proceedings of the 16th International Workshop on Semantic Evaluation (SemEval-2022), pp. 820–826, 2022.
[43] Y. Liu et al., “Roberta: A robustly optimized bert pretraining approach,” ArXiv Prepr. ArXiv190711692, 2019.
[44] A. Conneau et al., “Unsupervised cross-lingual representation learning at scale,” ArXiv Prepr. ArXiv191102116, 2019.
[45] P. He, J. Gao, and W. Chen, “Debertav3: Improving deberta using electra-style pre-training with gradient-disentangled embedding sharing,” ArXiv Prepr. ArXiv211109543, 2021.
[46] Zhang Y, Ma D, Tiwari P, Zhang C, Masud M, Shorfuzzaman M, Song D. Stance-level Sarcasm Detection with BERT and Stance-centered Graph Attention Networks. ACM Transactions on Internet Technology. 2023 May 18;23(2):1-21.
[47] Yue T, Mao R, Wang H, Hu Z, Cambria E. KnowleNet: Knowledge fusion network for multimodal sarcasm detection. Information Fusion. 2023 Dec 1;100:101921.
[48] Tan YY, Chow CO, Kanesan J, Chuah JH, Lim Y. Sentiment Analysis and Sarcasm Detection using Deep Multi-Task Learning. Wireless personal communications. 2023 Apr;129(3):2213-37.
[49] Vitman O, Kostiuk Y, Sidorov G, Gelbukh A. Sarcasm detection framework using context, emotion and sentiment features. Expert Systems with Applications. 2023 Dec 30;234:121068.
[50] Q. Le and T. Mikolov, “Distributed representations of sentences and documents,” in International conference on machine learning, PMLR, 2014, pp. 1188–1196.
[51] Kadriu A, Abazi L, Abazi H. Albanian text classification: Bag of words model and word analogies. Business Systems Research: International journal of the Society for Advancing Innovation and Research in Economy. 2019 Apr 18;10(1):74-87
[52] F. Morin and Y. Bengio, “Hierarchical probabilistic neural network language model,” in International workshop on artificial intelligence and statistics, PMLR, pp. 246–252, 2005.
[53] B. Shmueli, L.-W. Ku, and S. Ray, “Reactive supervision: A new method for collecting sarcasm data,” ArXiv Prepr. ArXiv200913080, 2020.
[54] J. Bergstra and Y. Bengio, “Random search for hyper-parameter optimization.,” J. Mach. Learn. Res., vol. 13, no. 2, 2012.
[55] D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” ArXiv Prepr. ArXiv14126980, 2014.
[56] A.-C. Băroiu and  Ștefan Trăușan-Matu, “Automatic sarcasm detection: Systematic literature review,” Information, vol. 13, no. 8, p. 399, 2022.