Span Extraction Aided Improved Code-mixed Sentiment Classification

Ramaneswaran S, Sean Benhur, Sreyan GhoshW-NUT @ COLING 2022

Abstract

Sentiment analysis in code-mixed text presents unique challenges due to linguistic complexity and resource scarcity. This paper introduces a novel transformer-based framework that jointly performs sentiment classification and span extraction for Tamil-English code-mixed data. By employing a Task Interaction Module (TIM) with a co-attention mechanism, the model establishes a bidirectional information flow between tasks. Our results demonstrate that this interactive approach significantly outperforms standard multi-task learning baselines, achieving a 64.12% F1-score on a newly curated Tamil-English dataset and showing strong generalization on English benchmarks.

Introduction

Sentiment classification is a fundamental task in Natural Language Processing (NLP), but its complexity increases significantly when dealing with code-mixed text. Code-mixing—the practice of alternating between languages like Tamil and English within a single social media post—is common in multilingual communities but suffers from a lack of high-quality annotated resources.

A key limitation of existing models is task isolation. Typically, sentiment classification (labeling a sentence) and span extraction (identifying the words that trigger the sentiment) are treated as separate or loosely coupled tasks. The authors argue that these tasks are deeply intertwined: knowing why a sentence has a certain sentiment (the span) should help determine what that sentiment is (the label), and vice versa.

Conceptual comparison between (a) standard multi-task learning with a shared backbone and (b) the proposed approach featuring bidirectional task interaction.

Methodology

The core of the proposed framework is a unified transformer architecture featuring a specialized Task Interaction Module (TIM). Unlike standard Multi-Task Learning (MTL) which simply shares a backbone, this architecture forces the two tasks to interact explicitly.

The overall model architecture (left) and the detailed Task Interaction Module (right) illustrating the co-attention mechanism between sentiment and span representations.

Key Components

  • Text Encoder: The model utilizes MURIL (Multilingual Representations for Indian Languages), which outperforms standard Multilingual BERT (MBERT) due to its specific training on Indian language corpora and romanized scripts.
  • Label Attention Layer: This layer produces explicit sentiment and span representations by attending to the actual labels, helping the model focus on sentiment-bearing tokens.
  • Co-Attention Mechanism: This is the central innovation. It establishes a bidirectional flow of information where the sentiment classification task provides context to help find the right spans, while the span extraction task highlights the most important words to improve the classifier's final decision.
  • Word Features: A sliding window of features for each token captures local context before making final predictions.

Data and Resources

The researchers contributed a significant new resource: the Tamil-English Code-Mixed Span Extraction Dataset. They extended the DravidianCodemix dataset by having native Tamil speakers manually annotate 2,152 comments with gold-standard sentiment spans. This represents the first dataset of its kind for code-mixed Tamil. To demonstrate generalizability, the model was also evaluated on the standard English Twitter Sentiment Extraction dataset.

Results and Discussion

The proposed approach showed clear improvements over both Single-Task (STL) and standard Multi-Task (MTL) baselines:

  • Tamil-English Dataset: The model achieved an F1-score of 64.12% for sentiment classification (a 1.27% improvement over MTL) and a 2.78% absolute improvement in Exact Match (EM) for span prediction.
  • English Twitter Dataset: The model outperformed the MTL baseline by 2.02% in F1 for classification and 1.09% in EM for spans.

These results validate the "bidirectional is better" hypothesis. By explicitly modeling the interaction via co-attention, the model learns more robust semantic representations. Span extraction acts as a powerful auxiliary signal, preventing the model from relying on spurious correlations.

Conclusion

This work demonstrates that integrating sentiment classification and span extraction through an interactive module significantly improves performance on code-mixed text. While the current dataset size is a limitation, the framework provides a strong foundation for future research in low-resource, multilingual NLP. Future work will explore more complex polyglot environments involving three or more languages.

Summary updated

BibTeX
@inproceedings{s2022span,
  author = {Ramaneswaran S and Sean Benhur and Sreyan Ghosh},
  title = {{Span Extraction Aided Improved Code-mixed Sentiment Classification}},
  booktitle = {W-NUT @ COLING},
  year = {2022},
  url = {https://openreview.net/forum?id=93F13_PyfP},
}
Figure