Improved Sentiment Detection via Label Transfer from Monolingual to Synthetic Code-Switched Text

Bidisha Samanta, Niloy Ganguly, Soumen Chakrabarti · DOI

TL;DR

This paper introduces CSGen, a novel method for automatically generating synthetic code-switched text with sentiment labels. By leveraging existing monolingual sentiment-labeled data and machine translation, CSGen creates a large, labeled code-switched corpus that significantly improves sentiment analysis performance, especially in low-resource scenarios.

What Problem Does This Paper Address?

Sentiment analysis (SA) is crucial for understanding public opinion on social media. However, a major hurdle in developing robust SA systems is the scarcity of large, labeled datasets. This problem is exacerbated in code-switched (CS) text, where speakers alternate between two or more languages within a single discourse. Manually labeling CS text is time-consuming and requires multilingual expertise, making it prohibitively expensive to create large corpora, especially for language pairs involving minority languages. Existing SA models trained on monolingual data often perform poorly on CS text due to linguistic differences and the lack of sufficient training data.

Methods

The core contribution of this paper is the CSGen system, which synthesizes labeled code-switched text from readily available monolingual sentiment-labeled data. The process involves several key steps:

  1. Monolingual Data Translation: A resource-rich language corpus (e.g., English) with sentiment labels is translated into a resource-poor target language (e.g., Hindi, Spanish, Bengali) using a standard machine translation system. This creates a parallel corpus.
  2. Sentiment-Oriented Source Segment Selection: CSGen identifies candidate segments within the source sentence that are suitable for replacement. This selection is guided by the observation that code-switching often occurs at constituent boundaries (like noun phrases and verb phrases) and that highly opinionated segments are prone to switching. A constituency parser is used to identify these segments.
  3. Target Segment Selection: For each selected source segment, CSGen identifies a corresponding segment in the translated target sentence. This is done using two main approaches:
  4. Maximum Similarity: Selecting a target segment that is most similar to the source segment, using word alignment signals from GIZA++ or NMT attention scores.
  5. Minimum Dissimilarity: Selecting a target segment that is least dissimilar to the source segment, employing measures like Earth Mover's Distance (EMD) with attention-based or GIZA-based distances.
  6. Code-Switched Text Generation: The identified target segment replaces the source segment. The Google Transliteration API is then used to transliterate the replaced segment into the source script, creating a synthetic code-switched sentence.
  7. Label Transfer: The synthetic code-switched sentence inherits the sentiment label from the original monolingual source sentence.
  8. Candidate Selection and Refinement: Multiple synthetic candidates are generated for each source sentence. These candidates are then ranked using metrics like BLEU score (via reverse translation) and word overlap to select the best one. Thresholding and stratified sampling are also applied to further refine the synthetic data.

Datasets

The paper utilizes several publicly available monolingual sentiment-tagged corpora in English as source data for synthesis:

  • ACL: ~6000 English tweets.
  • Election: ~5000 English tweets.
  • Mukherjee: ~8000 English tweets.
  • Semeval shared task: ~10000 English tweets.
  • Union: A combination of the above datasets.
  • Hatespeech: ~15K English tweets (including abusive and hateful tweets).

For evaluation, the authors use three code-switched language pair datasets:

  • HI-EN, FB (Hindi-English, Facebook): ~4000 labeled CS tweets.
  • HI-EN, TW (Hindi-English, Twitter): ~15575 labeled CS tweets.
  • ES-EN (English-Spanish): ~2883 labeled CS tweets.
  • BN-EN (Bengali-English): ~2499 labeled CS tweets.

Key Insights and Ideas

  • Synthetic Data as a Powerful Augmentation Tool: The paper convincingly demonstrates that synthetically generated code-switched text, when augmented with scarce natural CS data, can significantly boost sentiment analysis performance. This is a crucial finding for low-resource languages.
  • Leveraging Monolingual Data: The ability to leverage abundant monolingual sentiment data by translating and then strategically "code-switching" it is a key innovation. This circumvents the need for extensive manual labeling of CS text.
  • Constituency Parsing for Naturalness: Using constituency parses to identify switching points helps create more linguistically plausible code-switched sentences, as code-switching often adheres to grammatical structures.
  • Opinionated Segments as Switching Hotspots: The observation that highly opinionated segments are more likely to be code-switched provides a valuable heuristic for segment selection.
  • Similarity vs. Dissimilarity for Target Selection: Employing both similarity and dissimilarity measures for selecting target segments offers a more robust approach to finding suitable replacements that blend well.
  • Domain Coherence Matters (but not always critically): While the paper notes that a mismatch between synthetic and test data domains can impact performance (as seen in Table 1), the overall gains suggest that the benefits of augmentation often outweigh this challenge.

Key Results

  • Significant Accuracy Improvements: Augmenting natural code-switched text with synthetic data led to substantial improvements in sentiment labeling accuracy across various language pairs:
  • English-Spanish: 5.11% gain.
  • English-Bengali: 7.20% gain.
  • English-Hindi (Twitter): 1.5% gain.
  • English-Hindi (Facebook): 0.97% gain.
  • Hate Speech Detection Gains: A 4% F1 improvement was achieved using only synthetic text for hate speech detection, and a 6% boost when combined with gold data. Notably, synthetic text alone outperformed gold text in this scenario due to class imbalance in the gold data.
  • Synthetic Data Performance: In several cases, synthetic text alone performed nearly as well as natural text, highlighting its potential as a standalone training resource.
  • Ordinal Loss Benefits: Ordinal cross-entropy loss showed modest gains, particularly when the neutral sentiment label was dominant, but the difference was not substantial enough to consistently prefer it over categorical loss.

Limitations and Future Work

  • Domain Mismatch: The paper acknowledges that a significant mismatch between the domain of the source corpora used for synthesis and the target evaluation corpora can lead to performance degradation. This is particularly relevant for informal social media text.
  • Informal Text Challenges: The reliance on constituency parsers and standard linguistic theories might be less effective for highly informal or noisy social media text where grammatical structures are often broken.
  • Future Work: The authors suggest exploring more sophisticated methods for domain coherence and investigating the impact of synthetic text on other NLP tasks beyond sentiment analysis. They also implicitly point towards the need for better handling of weak or mixed emotions, as identified in their error analysis.

Summary updated

BibTeX
@inproceedings{samanta2019improved,
  author = {Bidisha Samanta and Niloy Ganguly and Soumen Chakrabarti},
  title = {{Improved Sentiment Detection via Label Transfer from Monolingual to Synthetic Code-Switched Text}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1343},
}
Figure