GCM: A Toolkit for Generating Synthetic Code-mixed Text

Mohd Sanad Zaki Rizvi, Anirudh Srinivasan, Tanuja Ganu, Monojit Choudhury, Sunayana SitaramEACL (System Demonstrations) 2021

TL;DR

This paper introduces GCM, a toolkit for automatically generating synthetic code-mixed text from parallel monolingual data. By implementing linguistic theories of code-mixing, GCM aims to alleviate the data scarcity problem for training NLP models that handle multilingual communication, offering modes for researchers, linguists, and developers.

What Problem Does This Paper Address?

Code-mixing, the practice of alternating between languages within a single utterance, is common in multilingual communities but poses a significant challenge for Natural Language Processing (NLP). The primary hurdle is the scarcity of labeled and unlabeled code-mixed data, which is crucial for training robust NLP models. This data is often difficult to obtain because code-mixing is more prevalent in informal written text (like social media and chat logs) and can suffer from inconsistencies like cross-transcription and non-standard spellings. To address this, the authors propose generating synthetic code-mixed data as a promising solution.

Methods

The GCM toolkit employs a pipeline with three main stages:

  1. Alignment Stage: This stage uses an aligner (specifically "fast_align") to generate word-level alignments between pairs of input sentences.
  2. Pre-GCM Stage: This stage preprocesses the input by combining the alignment outputs with constituent parse trees (generated by parsers like Stanford Parser or Berkeley Neural Parser) and a "Pseudo Fuzzy-match Score." This creates a structured input for the next stage.
  3. GCM Stage: This core stage applies linguistic theories to generate code-mixed sentences. The toolkit currently implements two prominent theories:
  4. Equivalence Constraint (EC) Theory: This theory posits that code-mixing can only occur at points where the grammatical structures of the two languages align, implicitly respecting the rules of both.
  5. Matrix Language (ML) Theory: This theory suggests that one language (the "Matrix Language") provides the grammatical framework, while the other ("Embedded Language") "switches in" at grammatically appropriate points.

Following generation, a sampling stage is included to select sentences that are more natural-sounding. The paper discusses Random sampling (picking a fixed number of sentences) and SPF-based sampling (selecting sentences based on their Switch Point Fraction).

The toolkit is made available in three modes:

  • Batch Mode: For large-scale data generation on servers, configurable via a file.
  • Library Mode: A lightweight, interactive interface for programmers to experiment with different stages and parameters.
  • Web UI: An intuitive interface for linguists and language experts to visualize code-mixing theories and generate sentences for single input pairs.

Datasets

The paper does not explicitly list specific datasets used for training or evaluation. However, it states that the GCM toolkit requires parallel data in two languages or a machine translation system between those languages as input. The generated synthetic data is intended for pre-training NLP models, and the authors mention its successful use in improving downstream performance on tasks like sentiment analysis, POS tagging, and code-switched NLP benchmarks (like GLUECOS).

Key Insights and Ideas

  • Bridging the Data Gap: The core insight is that synthetic data generation, guided by linguistic theories, can effectively overcome the data scarcity problem for code-mixed language processing.
  • Linguistic Theories as Generators: Implementing established linguistic theories (EC and ML) provides a principled way to generate grammatically plausible code-mixed sentences, moving beyond random or heuristic approaches.
  • The Importance of Sampling: Not all synthetically generated sentences are natural. The paper highlights that sampling techniques are crucial for producing high-quality synthetic data that mimics real-world code-mixing.
  • Multimodal Toolkit: Offering batch, library, and web UI modes caters to diverse user needs, from large-scale data generation to interactive exploration and visualization.

Key Results

The paper focuses on the development and capabilities of the GCM toolkit rather than presenting extensive quantitative results from specific NLP tasks. However, it references prior work where:

  • Generating synthetic data using their computational implementations improved word embeddings, leading to better downstream performance on sentiment analysis and POS tagging.
  • A multilingual BERT model fine-tuned with synthetic code-mixed data outperformed prior techniques on the GLUECOS benchmark.

The paper demonstrates the toolkit's ability to generate code-mixed sentences based on the EC theory, showing example outputs for Hindi-English and Spanish-English pairs. It also visualizes the parse trees generated by the EC theory, illustrating the grammatical underpinnings of the generated code-mixed sentences.

Limitations and Future Work

Limitations: * The "Linguistic Features-based" sampling technique, while promising for learning realistic switching patterns, is not yet implemented due to the unavailability of POS taggers for code-mixed data. * The SPF-based sampling method requires real CM data for comparison to determine the optimal SPF distribution.

Future Work: * Release the GCM toolkit as open-source. * Add more implementations of linguistic theories, generation techniques, and sampling algorithms. * Extend language coverage and improve visualization capabilities. * Further research into more sophisticated sampling techniques. * Investigate the use of the toolkit for evaluating linguistic theories across different language pairs.

Summary updated

BibTeX
@inproceedings{rizvi2021gcm,
  author = {Mohd Sanad Zaki Rizvi and Anirudh Srinivasan and Tanuja Ganu and Monojit Choudhury and Sunayana Sitaram},
  title = {{GCM: A Toolkit for Generating Synthetic Code-mixed Text}},
  booktitle = {EACL (System Demonstrations)},
  year = {2021},
  url = {https://openreview.net/forum?id=Bx--Yb5fzX9},
}
Figure