NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Automatic Identification of Code-Switching Functions in Speech Transcripts

Ritu Belani, Jeffrey Flanigan

Abstract

While Natural Language Processing (NLP) has become proficient at identifying when a speaker switches languages (code-switching), the why behind these switches remains a significant challenge. This paper introduces a new annotated dataset and a transformer-based system designed to automatically identify the communicative functions of Spanish-English code-switching—such as making a joke, introducing a new topic, or borrowing a term. By treating this as a multi-label classification problem, the researchers achieved a peak average accuracy of 75.4% across 11 distinct categories, demonstrating that the social and pragmatic nuances of bilingual speech are quantifiable.

Introduction

Multilingual speakers do not switch languages at random. Code-switching (CS) serves vital communicative functions: a speaker might switch to English to deliver a punchline or to Spanish to quote a relative. For linguists, these switches provide insight into the bilingual mind. For speech-language pathologists, understanding these functions is critical for clinical accuracy; misinterpreting a strategic code-switch as a language disorder can lead to the misdiagnosis in bilingual children. Despite its importance, most computational work has focused on low-level tasks like Language Identification (LID). This study fills the gap by providing tools to identify high-level intent across broad conversational contexts.

Dataset and Annotation

The study utilizes a subset of the Bangor Miami Corpus, a collection of spontaneous Spanish-English conversations. The authors annotated 1,379 utterances (7,547 sentences) across 11 communicative functions.

Table 2: Frequency of labels and inter-annotator agreement (Cohen-Kappa) for the 11 functional categories.

As shown in the data, "Change topic" was the most frequent function (65%) and saw the highest human agreement (0.60 Cohen-Kappa). In contrast, rare and subjective labels like "Surprise" proved more difficult for both humans and models to categorize consistently.

Methodology

The researchers treated functional identification as a multi-label classification task, building unique classifiers for each label. They fine-tuned several state-of-the-art multilingual models:

  • mBERT (multilingual BERT): A standard cross-lingual benchmark.
  • XLM-RoBERTa (XLM-R): A robustly trained multilingual model.
  • Adapters: Small, trainable modules inserted into frozen models to prevent overfitting on the relatively small dataset.
  • Naive Bayes: A traditional baseline for comparison.

To address class imbalance, balanced training sets were created for each label, preventing the models from simply defaulting to the most frequent categories.

Key Results

The experimental results demonstrate the superiority of transformer-based architectures over traditional baselines.

Table 1: Performance comparison of various models across the 11 functional labels.

XLM-RoBERTa emerged as the top performer, achieving an average accuracy of 75.4%. Both mBERT (74.4%) and XLM-R significantly outperformed the Naive Bayes baseline (59.2%), confirming that deep contextual embeddings are essential for capturing conversational intent. Interestingly, adding adapter layers did not consistently improve performance, likely because the dataset size allowed for effective full fine-tuning.

Discussion and Clinical Utility

Qualitative analysis revealed that models excel at identifying "Borrowing" when the target word is distinct within a long string of another language. However, utterances with multiple switching points remain a challenge.

A key takeaway is the potential for clinical application. By automating the identification of "Fillers" or "Borrowing," these tools can help speech therapists recognize that a child is not "struggling" for words, but rather using their full linguistic repertoire to maintain conversational flow.

Limitations and Future Work

The authors note several limitations:

  1. Domain Specificity: The system is trained on everyday speech; performance on "noisy" social media data or formal text is unknown.
  2. Transcript Dependency: The models rely on high-quality human transcripts, whereas real-world applications would face errors from Automatic Speech Recognition (ASR).
  3. Language Pairs: The work is currently limited to Spanish-English. Future research should investigate if these functional patterns generalize to other pairs like Hindi-English or Arabic dialects.

This research marks a significant step toward NLP systems that understand the social and emotional "moves" speakers make in a multilingual world.

Summary updated

BibTeX
@inproceedings{belani2023automatic,
  author = {Ritu Belani and Jeffrey Flanigan},
  title = {{Automatic Identification of Code-Switching Functions in Speech Transcripts}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.findings-acl.469},
}
Figure