Abstract
Training code-switched language models is difficult due to lack of data and complexity in the grammatical structure. Linguistic constraint theories have been used for decades to generate artificial code-switching sentences to cope with this issue. However, this require external word alignments or constituency parsers that create erroneous results on distant languages. We propose a sequence-to-sequence model using a copy mechanism to generate code-switching data by leveraging parallel monolingual translations from a limited source of code-switching data. The model learns how to combine words from parallel sentences and identifies when to switch one language to the other. Moreover, it captures code-switching constraints by attending and aligning the words in inputs, without requiring any external knowledge. Based on experimental results, the language model trained with the generated sentences achieves state-of-the-art performance and improves end-to-end automatic speech recognition.
Introduction
Code-switching (CS)—the practice of alternating between two or more languages within a single conversation or sentence—is a prevalent linguistic phenomenon in multicultural communities. Despite its commonality, developing robust Language Models (LMs) and Automatic Speech Recognition (ASR) systems for CS speech remains a significant challenge. The primary obstacles are two-fold: the extreme scarcity of large-scale, high-quality CS datasets and the structural complexity arising from differing grammatical rules between languages like English and Mandarin.
Traditional methods for generating synthetic CS data often rely on rigid linguistic theories, such as the Equivalence Constraint (EC). These methods typically require external tools like word aligners or part-of-speech taggers, which frequently produce errors when applied to "distant" language pairs with disparate syntax. This research introduces a novel approach using a Pointer-Generator network to create high-quality synthetic CS data by learning to "stitch" parallel monolingual sentences together naturally.
Methodology
The core of the proposed system is a Pointer-Generator (Pointer-Gen) network designed to generate synthetic CS data from parallel monolingual translations.
The Pointer-Generator Mechanism
Unlike standard sequence-to-sequence models that generate words solely from a fixed vocabulary, the Pointer-Gen model incorporates a copy mechanism. When generating a sentence, the model calculates a generation probability ($p_{gen}$). This probability allows the model to decide at each step whether to generate a word from its general vocabulary or to "point" to and copy a specific word from the input parallel sentences.
Learning Implicit Constraints
By training on a small amount of real CS data, the model learns the "grammar of mixing" implicitly. It uses an internal attention mechanism to align words across the parallel input sentences (e.g., aligning "check" with "检查"). This allows the model to identify valid "switch points" where a transition between languages is grammatically appropriate, without requiring explicit linguistic rules or external parsers.
Experimental Setup
The researchers utilized several key datasets for training and evaluation:
- SEAME Phase II: A conversational English-Mandarin CS corpus served as the primary benchmark.
- Synthetic Data Generation: To create the parallel pairs needed for the Pointer-Gen model, the authors used Google NMT to translate the SEAME training set into pure English and pure Mandarin. This process allowed for the generation of over 270,000 new CS sentences—effectively tripling the size of the original training set.
- Monolingual Pre-training: HKUST (Mandarin) and Common Voice (English) datasets were used to pre-train the ASR system.
Results and Discussion
The effectiveness of the Pointer-Gen approach was evaluated across Language Modeling and ASR tasks.
Language Modeling Performance
In terms of Perplexity (PPL), where lower values indicate better predictive performance, the Pointer-Gen model achieved a score of 59.74. This significantly outperformed the Equivalence Constraint baseline (61.42) and the SeqGAN approach (64.03). As shown in the performance analysis, the Pointer-Gen model maintains a lower perplexity even as the sample size of generated data increases, demonstrating its ability to produce high-quality, realistic sentences.
ASR and Diversity
On the ASR task, fine-tuning the system with Pointer-Gen synthetic data reduced the Character Error Rate (CER) from a baseline of 34.40% to 31.07%. Furthermore, the model demonstrated an impressive ability to generate novel n-grams (word sequences) not present in the original training data, enhancing the system's ability to generalize to new speakers and contexts.
Conclusion
This study presents a robust, language-agnostic method for generating synthetic code-switched data. By leveraging parallel sentences and a pointer-generator network, the model captures complex linguistic constraints implicitly. While the method currently depends on the quality of initial Machine Translations (NMT), it offers a scalable solution for low-resource CS language pairs. Future work will explore longer utterance generation and scenarios with shifting "matrix" languages.
Summary updated