An Explainable and Cross-Lingual Machine Learning Framework for Offensive Content Detection in Tamil–English Code-Mixed Social Media Text
DOI:
https://doi.org/10.32595/Keywords:
Code-mixed NLP, Offensive Language Detection, Tamil–English, Explainable AI, Transformer Models, Cross-Lingual GeneralizationAbstract
Social media platforms are rife with multilingual and code-mixed posts, making automatic offensive-content detection difficult, especially for low-resource languages. Tamil-English code-mixed posts present additional challenges, including transliteration, non-canonical spellings, lexical switches, and contextual offensiveness, among other issues. This paper presents an explainable machine-learning framework for detecting offensive content in Tamil-English code-mixed social media posts. This framework relies on the publicly available DravidianCodeMix dataset and employs Logistic Regression, Support Vector Machine (SVM), Random Forest, and the transformer-based XLM-RoBERTa model. Word-level and character-level Term Frequency-Inverse Document Frequency (TF-IDF) representations are evaluated for classical machine-learning models, while XLM-RoBERTa is fine-tuned for classification. A cross-lingual generalization experiment is conducted to evaluate the transfer of models trained on Tamil-English code-mixed posts to Malayalam-English code-mixed posts. Feature-importance analysis is conducted to understand which features have the most significant impact on detection. XLM-RoBERTa achieves the highest accuracy (83.41%) and macro-F1 (77.87%), while character-level SVM attains 82.65% accuracy and 74.09% macro-F1. On the cross-lingual experiment, the macro-F1 scores are 54.24% and 44.94% for XLM-RoBERTa and character-level SVM, respectively. The proposed framework offers a reproducible and interpretable baseline for code-mixed offensive-content detection.