Towards Offensive Language Identification for Tamil Code-Mixed YouTube Comments and Posts

Charangan Vasantharajan, Uthayasanker Thayasivam

Introduction

Social media moderation is a complex challenge, particularly in multilingual societies where "code-mixing" is prevalent. In these contexts, users often blend multiple languages and scripts within a single post. For instance, a Tamil YouTube comment might combine English words, Tamil words written in Roman characters (often called "Tanglish"), and native Tamil script.

Existing Natural Language Processing (NLP) models, such as BERT, are typically pre-trained on native scripts. When encountering Romanized Tamil, these models often fail because the lexical representation does not align with their training data. Furthermore, Tamil is a "low-resource" language in the AI domain, lacking the vast labeled datasets available for languages like English. This research addresses the detection of offensive content—ranging from targeted insults to untargeted hate speech—within this linguistically diverse and messy real-world data.

Dataset and the Challenge of Class Imbalance

The study utilizes the Offensive Language Identification in Dravidian Languages (ODL) dataset, specifically the Tamil-English subset. The dataset comprises 35,139 training instances, 4,388 validation instances, and 4,392 test instances.

A significant hurdle in this task is the extreme class imbalance. As shown in the distribution of labels, the vast majority of comments are categorized as "Not-Offensive."

Distribution of labels in the Tamil code-mixed dataset, highlighting the significant class imbalance.

The labels include:

  • Not-Offensive (72.4%)
  • Offensive-Targeted-Insult-Individual (6.7%)
  • Offensive-Targeted-Insult-Group (7.3%)
  • Offensive-Targeted-Insult-Other (1.3%)
  • Offensive-Untargeted (8.3%)
  • Not-Tamil (4.1%)

This imbalance makes it difficult for models to learn the nuances of rarer offensive categories, such as insults directed at specific groups or abstract entities.

Methodology

The researchers proposed a two-pronged strategy involving a novel preprocessing algorithm and a comparative study of deep learning architectures.

Selective Translation and Transliteration (STT)

The core innovation is the Selective Translation and Transliteration (STT) algorithm. Instead of feeding raw code-mixed text into a model, STT normalizes the input into native Tamil script through a three-step process:

  1. Translation: English words are translated into native Tamil.
  2. Preservation: Native Tamil script is left unchanged.
  3. Transliteration: Romanized Tamil (e.g., "vaaya") is converted into native Tamil script.

This normalization aligns the input with the pre-trained knowledge of multilingual models, effectively "unlocking" their capability to process Romanized content.

Model Architectures

The study evaluated several architectures:

  • ULMFiT: A transfer learning approach utilizing gradual unfreezing and slanted triangular learning rates.
  • mBERT-BiLSTM: A hybrid model combining Multilingual BERT with a Bidirectional Long Short-Term Memory network.
  • XLM-RoBERTa & DistilBERT: Standard transformer-based models.
  • CNN-BiLSTM: A custom architecture for feature extraction.

Results and Discussion

The experimental results demonstrate that ULMFiT is the most resilient model in this low-resource, imbalanced setting.

Performance comparison of various models on the Tamil code-mixed dataset.

ULMFiT achieved the highest weighted F1-score of 0.7401, followed closely by mBERT-BiLSTM at 0.7341. Interestingly, standard transformer models like XLM-RoBERTa and DistilBERT performed significantly worse (F1-scores of ~0.61 and ~0.60, respectively). This suggests that ULMFiT's fine-tuning techniques are better at preserving general language knowledge while adapting to specific downstream tasks in low-resource environments.

The models struggled most with the "Offensive-Targeted-Insult-Other" category. This indicates that sarcasm and insults directed at abstract entities or events remain a significant challenge for current AI systems compared to direct, keyword-heavy personal attacks. Overall, the proposed system ranked competitively in the global benchmark, placing between the top-performing "OFFLangOne" and "es" teams in the ODL competition.

Conclusion and Future Work

This research highlights that script alignment is crucial for effective NLP in code-mixed environments. By converting Romanized text to native script via STT, the performance of multilingual models can be significantly enhanced.

Future work will focus on refining the STT algorithm to better handle full English sentences without losing semantic meaning, developing custom Tamil word embeddings, and implementing oversampling techniques to further mitigate the effects of class imbalance.

Summary updated

BibTeX
@article{vasantharajan2022towards,
  author = {Charangan Vasantharajan and Uthayasanker Thayasivam},
  title = {{Towards Offensive Language Identification for Tamil Code-Mixed YouTube Comments and Posts}},
  journal = {Sn Comput. sci},
  year = {2022},
  doi = {10.1007/s42979-021-00977-y},
}
Figure