Exploring Segmentation Approaches for Neural Machine Translation of Code-Switched Egyptian Arabic-English Text

Marwa Gaser, Manuel Mager, Injy Hamed, Nizar Habash, Slim Abdennadher, Ngoc Thang Vu

Abstract

Code-switching (CS) presents significant challenges for Neural Machine Translation (NMT), particularly when involving morphologically rich languages like Egyptian Arabic (EGY). This study evaluates various word segmentation strategies—linguistically-informed morphological analysis, frequency-based subword units, and hybrid approaches—to determine their impact on translation performance. Our findings indicate that while supervised morphological segmentation is linguistically superior, standard Byte-Pair Encoding (BPE) remains highly robust. However, a hybrid approach combining morphological pre-segmentation with BPE yields the best performance, especially in low-resource scenarios.

Introduction

Code-switching, the alternation between languages within a single discourse, is a common phenomenon in multilingual communities but a major hurdle for NMT. In Egyptian Arabic, morphological complexity allows a single word to function as an entire phrase (e.g., "and-will-he-write-it"). Intra-sentential code-switching and morphological code-switching (MCS)—where prefixes or suffixes from one language are applied to stems of another—exacerbate data sparsity. Effective word segmentation is crucial to mitigate this sparsity by breaking down rare word forms into more frequent sub-units.

Methodology

We categorize word segmenters into three main types:

  1. Unsupervised Morphology-based: Tools such as Morfessor, FlatCat, and LMVR that attempt to identify morphemes through statistical patterns without labeled data.
  2. Unsupervised Frequency-based: Byte-Pair Encoding (BPE), which iteratively merges frequent character sequences regardless of linguistic meaning.
  3. Supervised Morphology-based: MADAMIRA, a specialized tool for Arabic that segments words based on the Arabic Treebank (ATB) scheme.

Additionally, we propose a hybrid approach where supervised morphological segmentation is applied first, followed by BPE on the resulting segments to further optimize the vocabulary and reduce the number of out-of-vocabulary (OOV) tokens.

Experimental Setup

The study utilizes the ArzEn corpus, consisting of approximately 6,200 parallel sentences of Egyptian Arabic-English speech transcriptions. To evaluate segmentation accuracy, we introduced ArzEnSEG, a gold-standard dataset of 500 manually annotated lines. Unsupervised models were pre-trained on a larger monolingual corpus of 308k sentences.

Results and Discussion

The experimental results highlight a disconnect between linguistic accuracy and translation quality. While MADAMIRA (ATB) achieved the highest linguistic segmentation accuracy (EMMA F1 of 0.939), it did not translate to the highest chrF2 scores in isolation.

Translation Performance

As shown in the results table, the hybrid model ($MT_{ATB+BPE}$) and the pure BPE model ($MT_{BPE}$) achieved the highest translation scores on the test set, reaching 53.8 and 53.7 chrF2 points respectively.

Translation performance (chrF2) across different segmentation strategies on dev and test sets.

The OOV Problem and BPE Robustness

A primary reason for the success of BPE-based methods is their ability to eliminate Out-of-Vocabulary (OOV) tokens. Pure morphological segmenters like $MT_{ATB}$ suffer from high OOV rates (9.7%), as they may produce rare segments that the NMT model cannot effectively learn. In contrast, BPE-based models maintain a 0% OOV rate.

Comparison of Out-of-Vocabulary (OOV) rates for different segmentation models, highlighting the high OOV of pure morphological approaches.

Low-Resource Scenarios

The value of linguistic information becomes most apparent when training data is limited. In experiments using only 25% of the training data, the hybrid $MT_{ATB+BPE}$ model outperformed pure BPE by 1.4 chrF2 points. This suggests that linguistic structure provides a helpful inductive bias when statistical evidence is scarce.

Conclusion

This research demonstrates that while BPE is a powerful baseline for NMT of code-switched text, incorporating morphological knowledge through a hybrid approach offers significant benefits, particularly in low-resource settings. Future work will explore these strategies in other language pairs and refine segmentation for complex morphological code-switching, which remains the most difficult challenge for current NMT systems.

Summary updated

BibTeX
@inproceedings{gaser2023exploring,
  author = {Marwa Gaser and Manuel Mager and Injy Hamed and Nizar Habash and Slim Abdennadher and Ngoc Thang Vu},
  title = {{Exploring Segmentation Approaches for Neural Machine Translation of Code-Switched Egyptian Arabic-English Text}},
  booktitle = {EACL},
  year = {2023},
  doi = {10.18653/v1/2023.eacl-main.256},
}
Figure