Zera-Shot Sentiment Analysis for Code-Mixed Data

Siddharth Yadav, Tanmoy ChakrabortyAAAI 2021

Abstract

Sentiment analysis in code-mixed text—where speakers alternate between languages—remains a significant challenge due to data scarcity and linguistic complexity. This paper explores leveraging cross-lingual and multilingual embeddings to transfer knowledge from monolingual data to code-mixed environments. The authors demonstrate that models can achieve state-of-the-art performance in supervised settings and prove the viability of zero-shot learning, significantly reducing the need for labeled code-mixed datasets.

Introduction

Most natural language processing (NLP) models are designed for "clean," monolingual text. However, social media communication frequently involves code-mixing, the practice of alternating between two or more languages within a single conversation or sentence. Standard sentiment analysis tools often fail in these contexts due to three primary factors:

  1. Data Scarcity: High-quality, labeled code-mixed datasets are rare compared to monolingual ones.
  2. Complexity: The combination of grammars and vocabularies from multiple languages creates a vast search space.
  3. Domain Gap: Informal social media language, characterized by misspellings and slang, differs significantly from the formal text used to train many standard models.

This research investigates whether models trained on "pure" English and Spanish data can successfully predict sentiment in mixed English-Spanish text through zero-shot transfer.

Methodology

The researchers evaluated three primary strategies for creating a shared embedding space to bridge the linguistic gap:

  • Mapping-based Models (MUSE): Utilizing the MUSE framework to align separate monolingual word embedding spaces via a transformation matrix. Both unsupervised (MUSE-USUP) and supervised (MUSE-SUP) versions were tested.
  • Pseudo-multilingual Models: These models are trained on a single corpus containing multiple languages.
  • MultiBPEmd: A pre-trained model using Byte Pair Encoding (BPE) subword embeddings across 275 languages.
  • Custom-fastText: A model trained by the authors on a massive corpus of 160 million tweets (English, Spanish, and mixed).
  • Sentence-level Multilingual Autoencoders (LASER): LASER provides a single vector for an entire sentence using a language-agnostic Bi-LSTM encoder trained on over 200 million parallel sentences.

Classification was performed using a single-layer Bi-LSTM for word-level embeddings or a dense neural network for sentence-level embeddings.

Datasets

The study utilized five Twitter-based sentiment datasets:

  • English: ~25,000 tweets from SemEval-2017 and Sentistrength.
  • Spanish: ~10,000 tweets from Ceron-Guzmán and Villena-Román.
  • Code-mixed (English-Spanish): ~3,000 tweets from the Vilares et al. (2016) benchmark.

Results and Discussion

The experimental results established a new state-of-the-art (SOTA) for English-Spanish code-mixed sentiment analysis.

Comparison of F1-scores for supervised and zero-shot sentiment analysis on code-mixed data.

Key Performance Metrics

  • Supervised SOTA: The Custom-fastText model achieved an F1-score of 67.71%, surpassing the previous best of 64.60%.
  • Zero-Shot Performance: Without seeing any labeled code-mixed examples during training, the LASER-based model achieved an F1-score of 61.72%, which is highly competitive with older supervised methods.
  • Zero-Shot (No Parallel Corpus): Even without parallel training data, the Custom-fastText model yielded a solid 58.40% F1-score in a zero-shot setting.

Insights

The success of FastText and MultiBPEmd highlights the importance of subword-level information, which allows models to handle misspellings and hybrid words common in code-mixed data. Furthermore, the results suggest that including unlabeled code-mixed data during pre-training (as in Custom-fastText) significantly boosts performance by capturing unique syntactic features of language switching. Finally, the strong performance of LASER indicates that sentence-level "intent" is often preserved across languages even when word-to-word mappings are inconsistent.

Conclusion

While the results are promising, a performance gap of approximately 6-9% remains between zero-shot and fully supervised models. Future work should address the unique syntactic nuances of different language pairs (e.g., Hindi-English) and explore better domain adaptation techniques. Nevertheless, zero-shot approaches represent a scalable path forward for code-mixed NLP, bypassing the bottleneck of manual data labeling for every possible language combination.

Summary updated

BibTeX
@inproceedings{yadav2021zera,
  author = {Siddharth Yadav and Tanmoy Chakraborty},
  title = {{Zera-Shot Sentiment Analysis for Code-Mixed Data}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i18.17967},
}
Figure