Log in

Toxic comment classification and rationale extraction in code-mixed text leveraging co-attentive multi-task learning

  • Original Paper
  • Published:
Language Resources and Evaluation Aims and scope Submit manuscript

Abstract

Detecting toxic comments and rationale for the offensiveness of a social media post promotes moderation of social media content. For this purpose, we propose a Co-Attentive Multi-task Learning (CA-MTL) model through transfer learning for low-resource Hindi-English (commonly known as Hinglish) toxic texts. Together, the cooperative tasks of rationale/span detection and toxic comment classification create a strong multi-task learning objective. A task collaboration module is designed to leverage the bi-directional attention between the classification and span prediction tasks. The combined loss function of the model is constructed using the individual loss functions of these two tasks. Although an English toxic span detection dataset exists, one for Hinglish code-mixed text does not exist as of today. Hence, we developed a dataset with toxic span annotations for Hinglish code-mixed text. The proposed CA-MTL model is compared against single-task and multi-task learning models that lack the co-attention mechanism, using multilingual and Hinglish BERT variants. The F1 scores of the proposed CA-MTL model with HingRoBERTa encoder for both tasks are significantly higher than the baseline models. Caution: This paper may contain words disturbing to some readers.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price includes VAT (Germany)

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

Data availability

The datasets used and/or analyzed during the current study will be available from the corresponding author upon request.

Notes

  1. https://github.com/doccano/doccano

  2. https://www.kaggle.com/competitions/jigsaw-unintended-bias-in-toxicity-classification/data

  3. https://aclanthology.org/2021.semeval-1.6

  4. https://huggingface.co/bert-base-multilingual-cased

  5. https://huggingface.co/xlm-roberta-base

  6. https://huggingface.co/google/muril-base-cased

  7. https://huggingface.co/l3cube-pune/hing-mbert-mixed

  8. https://github.com/l3cube-pune/code-mixed-nlp

  9. https://huggingface.co/l3cube-pune/hing-roberta-mixed

References

  • Badjatiya, P., Gupta, S., Gupta, M., et al. (2017). Deep learning for hate speech detection in tweets. In: Proceedings of the 26th International Conference on World Wide Web Companion. International World Wide Web Conferences Steering Committee, Republic and Canton of Geneva, CHE, WWW ’17 Companion, p 759-760, https://doi.org/10.1145/3041021.3054223

  • Bansal, V., Tyagi, M., Sharma, R., et al. (2022). A transformer based approach for abuse detection in code mixed indic languages. ACM Transactions on Asian Low-Resource Language Information Processing. https://doi.org/10.1145/3571818

    Article  Google Scholar 

  • Biradar, S., Saumya, S., & Chauhan, A. (2022). Fighting hate speech from bilingual hinglish speaker’s perspective, a transformer-and translation-based approach. Social Network Analysis and Mining, 12(1), 87.

    Article  Google Scholar 

  • Bohra, A., Vijay, D., Singh, V., et al. (2018). A dataset of Hindi-English code-mixed social media text for hate speech detection. In: Proceedings of the Second Workshop on Computational Modeling of People’s Opinions, Personality, and Emotions in Social Media. Association for Computational Linguistics, New Orleans, Louisiana, USA, pp 36–41, https://doi.org/10.18653/v1/W18-1105

  • Caruana, R. (1997). Multitask learning. Machine learning 28(1), 41–75. https://doi.org/10.1023/A:1007379606734

    Article  Google Scholar 

  • Chakrabarty, T., Gupta, K., Muresan, S. (2019). Pay “attention” to your context when classifying abusive language. In: Proceedings of the Third Workshop on Abusive Language Online, pp 70–79, https://doi.org/10.18653/v1/W19-3508

  • Chopra, S., Sawhney, R., Mathur, P., et al. (2020). Hindi-english hate speech detection: Author profiling, debiasing, and practical perspectives. Proceedings of the AAAI Conference on Artificial Intelligence, 34(01), 386–393. https://doi.org/10.1609/aaai.v34i01.5374

    Article  Google Scholar 

  • Conneau, A., Khandelwal, K., Goyal, N., et al. (2020). Unsupervised cross-lingual representation learning at scale. In: Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, pp 8440–8451, https://doi.org/10.18653/v1/2020.acl-main.747,

  • Da San Martino, G., Yu, S., Barrón-Cedeño, A., et al. (2019). Fine-grained analysis of propaganda in news article. In: Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp 5636–5646, https://doi.org/10.18653/v1/D19-1565

  • Davidson, T., Warmsley, D., Macy, M., et al. (2017). Automated hate speech detection and the problem of offensive language. In: Proceedings of the International AAAI Conference on Web and Social Media, pp 512–515, https://ojs.aaai.org/index.php/ICWSM/article/view/14955

  • Devlin, J., Chang, M.W., Lee, K., et al. (2019). BERT: Pre-training of deep bidirectional transformers for language understanding. In: Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp 4171–4186, https://doi.org/10.18653/v1/N19-1423

  • Gambäck, B., Sikdar, U.K. (2017). Using convolutional neural networks to classify hate-speech. In: Proceedings of the First Workshop on Abusive Language Online. Association for Computational Linguistics, pp 85–90, https://doi.org/10.18653/v1/W17-3013

  • Jose, N., Chakravarthi, B.R., Suryawanshi, S., et al. (2020). A survey of current datasets for code-switching research. In: 2020 6th International Conference on Advanced Computing and Communication Systems (ICACCS), pp 136–141, https://doi.org/10.1109/ICACCS48705.2020.9074205

  • Kamble, S., & Joshi, A. (2018). Hate speech detection from code-mixed hindi-english tweets using deep learning models. ar**v preprint ar**v:1811.05145

  • Khanuja, S., Bansal, D., Mehtani, S., et al. (2021). Muril: Multilingual representations for indian languages. ar**v preprint ar**v:2103.10730

  • Kiran Babu, N., & Hima Bindu, K. (2022). Attention-based bi-lstm network for abusive language detection. IETE Journal of Research pp 1–9. https://doi.org/10.1080/03772063.2022.2034534

  • Kiran Babu, N., & HimaBindu, K. (2022). Multi-task learning for toxic comment classification and rationale extraction. Journal of Intelligent Information Systems pp 1–31. https://doi.org/10.1007/s10844-022-00726-4

  • Li, S.S., & Murray, K. (2022). Language agnostic code-mixing data augmentation by predicting linguistic patterns. ar**v preprint ar**v:2211.07628

  • Ma, X., & Hovy, E. (2016). End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. In: Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp 1064–1074, https://doi.org/10.18653/v1/P16-1101

  • Madhu, H., Satapara, S., Modha, S., et al. (2023). Detecting offensive speech in conversational code-mixed dialogue on social media: A contextual dataset and benchmark experiments. Expert Systems with Applications, 215(119), 342.

    Google Scholar 

  • Malmasi, S., & Zampieri, M. (2017). Detecting hate speech in social media. ar**v preprint ar**v:1712.06427

  • Mathur, P., Sawhney, R., Ayyar, M., et al. (2018a). Did you offend me? classification of offensive tweets in Hinglish language. In: Proceedings of the 2nd Workshop on Abusive Language Online (ALW2). Association for Computational Linguistics, pp 138–148, https://doi.org/10.18653/v1/W18-5118

  • Mathur, P., Shah, R., Sawhney, R., et al. (2018b). Detecting offensive tweets in Hindi-English code-switched language. In: Proceedings of the Sixth International Workshop on Natural Language Processing for Social Media. Association for Computational Linguistics, pp 18–26, https://doi.org/10.18653/v1/W18-3504

  • Modha, S., Majumder, P., Mandl, T., et al. (2020). Detecting and visualizing hate speech in social media: A cyber watchdog for surveillance. Expert Systems with Applications, 161(113), 725. https://doi.org/10.1016/j.eswa.2020.113725

    Article  Google Scholar 

  • Mozafari, M., Farahbakhsh, R., & Crespi, N. (2019). A BERT-based transfer learning approach for hate speech detection in online social media. In: Complex Networks 2019: 8th International Conference on Complex Networks and their Applications, pp 928–940, https://doi.org/10.1007/978-3-030-36687-2_77

  • Mundra, S., & Mittal, N. (2022). Fa-net: fused attention-based network for hindi english code-mixed offensive text classification. Social Network Analysis and Mining, 12(1), 100.

    Article  Google Scholar 

  • Nakayama, H. (2018). seqeval: A python framework for sequence labeling evaluation. https://github.com/chakki-works/seqeval, software available from https://github.com/chakki-works/seqeval

  • Nayak, R., & Joshi, R. (2021). Contextual hate speech detection in code mixed text using transformer based approaches. ar**v preprint ar**v:2110.09338

  • Nayak, R., & Joshi, R. (2022). L3Cube-HingCorpus and HingBERT: A code mixed Hindi-English dataset and BERT language models. In: Proceedings of the WILDRE-6 Workshop within the 13th Language Resources and Evaluation Conference. European Language Resources Association, pp 7–12, https://aclanthology.org/2022.wildre-1.2

  • Nguyen, V.A., Nguyen, T.M., Quang Dao, H., et al. (2021). S-NLP at SemEval-2021 task 5: An analysis of dual networks for sequence tagging. In: Proceedings of the 15th International Workshop on Semantic Evaluation (SemEval-2021), pp 888–897, https://doi.org/10.18653/v1/2021.semeval-1.120

  • Palomino, M., Grad, D., & Bedwell, J. (2021). GoldenWind at SemEval-2021 task 5: Orthrus - an ensemble approach to identify toxicity. In: Proceedings of the 15th International Workshop on Semantic Evaluation (SemEval-2021). Association for Computational Linguistics, Online, pp 860–864, https://doi.org/10.18653/v1/2021.semeval-1.115

  • Pandey, R., & Singh, J. P. (2023). Bert-lstm model for sarcasm detection in code-mixed social media post. Journal of Intelligent Information Systems, 60(1), 235–254.

    Article  Google Scholar 

  • Pavlopoulos, J., Sorensen, J., Laugier, L., et al. (2021). SemEval-2021 task 5: Toxic spans detection. In: Proceedings of the 15th International Workshop on Semantic Evaluation (SemEval-2021), pp 59–69, https://doi.org/10.18653/v1/2021.semeval-1.6

  • Pennebaker, J.W., Francis, M.E., & Booth, R.J. (2001). Linguistic inquiry and word count: Liwc 2001. Mahway: Lawrence Erlbaum Associates 71(2001):2001

  • Pitsilis, G. K., Ramampiaro, H., & Langseth, H. (2018). Effective hate-speech detection in twitter data using recurrent neural networks. Applied Intelligence, 48, 4730–4742. https://doi.org/10.1007/s10489-018-1242-y

    Article  Google Scholar 

  • Qin, L., Liu, T., Che, W., et al. (2021). A co-interactive transformer for joint slot filling and intent detection. In: ICASSP 2021 - 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp 8193–8197, https://doi.org/10.1109/ICASSP39728.2021.9414110

  • Ramaneswaran, S., Vijay, S., & Srinivasan, K. (2022). TamilATIS: Dataset for task-oriented dialog in Tamil. In: Proceedings of the Second Workshop on Speech and Language Technologies for Dravidian Languages. Association for Computational Linguistics, pp 25–32, https://doi.org/10.18653/v1/2022.dravidianlangtech-1.4

  • Ranasinghe, T., Sarkar, D., Zampieri, M., et al. (2021). Wlv-rit at semeval-2021 task 5: A neural transformer framework for detecting toxic spans. ar**v preprint ar**v:2104.04630

  • Ruder, S. (2017). An overview of multi-task learning in deep neural networks. ar**v preprint ar**v:1706.05098

  • Sharma, A., Kabra, A., & Jain, M. (2022). Ceasing hate with moh: Hate speech detection in hindi-english code-switched language. Information Processing and Management 59(1):102,760. https://doi.org/10.1016/j.ipm.2021.102760

  • Shekhar, S., Garg, H., Agrawal, R., et al. (2023). Hatred and trolling detection transliteration framework using hierarchical lstm in code-mixed social media text. Complex & Intelligent Systems, 9(3), 2813–2826.

    Article  Google Scholar 

  • Singh, R., Choudhary, N., & Shrivastava, M. (2023). Automatic normalization of word variations in code-mixed social media text. In: Computational Linguistics and Intelligent Text Processing: 19th International Conference, CICLing 2018, Hanoi, Vietnam, March 18–24, 2018, Revised Selected Papers, Part I, pp 371–381, https://doi.org/10.1007/978-3-031-23793-5_30

  • Sreelakshmi, K., Premjith, B., & Soman, K. (2020). Detection of hate speech text in hindi-english code-mixed data. Procedia Computer Science, 171, 737–744. https://doi.org/10.1016/j.procs.2020.04.080

    Article  Google Scholar 

  • Standley, T., Zamir, A., Chen, D., et al. (2020). Which tasks should be learned together in multi-task learning? In: Proceedings of the 37th International Conference on Machine Learning, pp 9120–9132, https://proceedings.mlr.press/v119/standley20a.html

  • Vaswani, A., Shazeer, N., Parmar, N., et al. (2017). Attention is all you need. In: Advances in neural information processing systems, https://doi.org/10.5555/3295222.3295349

  • Viterbi, A. J. (2009). Viterbi algorithm. Scholarpedia, 4(1), 6246. https://doi.org/10.4249/scholarpedia.6246

    Article  Google Scholar 

  • Waseem, Z., & Hovy, D. (2016). Hateful symbols or hateful people? predictive features for hate speech detection on Twitter. In: Proceedings of the NAACL Student Research Workshop, pp 88–93, https://doi.org/10.18653/v1/N16-2013

  • Worsham, J., & Kalita, J. (2020). Multi-task learning for natural language processing in the 2020s: Where are we going? Pattern Recognition Letters, 136, 120–126. https://doi.org/10.1016/j.patrec.2020.05.031

    Article  Google Scholar 

  • **ang, T., Macavaney, S., Yang, E., et al. (2021). Toxccin: Toxic content classification with interpretability. In: Proceedings of the 11th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis., pp 1–12, https://aclanthology.org/2021.wassa-1.1

  • Zeng, J., Song, L., Su, J., et al. (2020). Neural simile recognition with cyclic multitask learning and local attention. In: Proceedings of the AAAI Conference on Artificial Intelligence, pp 9515–9522

  • Zhang, X., & Wang, H. (2016). A joint model of intent determination and slot filling for spoken language understanding. In: IJCAI, pp 2993–2999, https://doi.org/10.5555/3060832.3061040

  • Zhou, C., Liang, Y., Meng, F., et al. (2023). A multi-task multi-stage transitional training framework for neural chat translation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45(07), 7970–7985. https://doi.org/10.1109/TPAMI.2022.3233226

    Article  Google Scholar 

  • Zhu, Q., Lin, Z., Zhang, Y., et al. (2021). HITSZ-HLT at SemEval-2021 task 5: Ensemble sequence labeling and span boundary detection for toxic span detection. In: Proceedings of the 15th International Workshop on Semantic Evaluation (SemEval-2021), pp 521–526, https://doi.org/10.18653/v1/2021.semeval-1.63

Download references

Acknowledgements

Not applicable.

Funding

All authors have equal contributions.

Author information

Authors and Affiliations

Authors

Contributions

Not applicable.

Corresponding author

Correspondence to Hima Bindu Kommanti.

Ethics declarations

Conflict of interest

The authors declare that they have no competing interests.

Ethical approval

Not applicable.

Consent to participate

Not applicable.

Consent for publication

Not applicable.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Nelatoori, K.B., Kommanti, H.B. Toxic comment classification and rationale extraction in code-mixed text leveraging co-attentive multi-task learning. Lang Resources & Evaluation (2024). https://doi.org/10.1007/s10579-023-09708-6

Download citation

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s10579-023-09708-6

Keywords

Navigation