Automatic Identification of Code-Switching Functions in Speech Transcripts (2023)

Abstract: Code-switching, or switching between languages, occurs for many reasons and has important linguistic, sociological, and cultural implications. Multilingual speakers code-switch for a variety of communicative functions, such as expressing emotions, borrowing terms, making jokes, introducing a new topic, etc. The function of code-switching may be quite useful for the analysis of linguists, cognitive scientists, speech therapists, and others, but is not readily apparent. To remedy this situation, we annotate and release a new dataset of functions of code-switching in Spanish-English. We build the first system (to our knowledge) to automatically identify a wide range of functions for which speakers code-switch in everyday speech, achieving an accuracy of 75% across all functions.

## introduction code-switching, or switching between languages within the same utterance or sentence @xcite , commonly emerges in conversations between multilinguals and in written communication such as social media. in today's intersecting multilingual world, it is essential to develop computational tools that can process and analyze codeswitched speech and text. in recent years, there has been much progress in processing code-switched language. many codeswitched datasets have been collected for a diverse set of natural language processing tasks such as sentiment analysis, ner, conversational systems, and many others @xcite . workshops held on computational approaches to codeswitching have created shared tasks on language identification @xcite and named entity recognition (ner) @xcite in code-switched texts. nuanced tasks like humor detection, sarcasm detection, and hate detection have been applied to hindi-english code-switched data @xcite . despite these achievements, there is relatively little work on identifying the functions of code-switching. although there are annotation schemes @xcite and some annotated datasets @xcite @xcite , to our knowledge, there is no work automatically identifying the communicative function of a code-switch across a full range of qualities @xcite . there are many potential applications for the task proposed in this paper, including improved cognitive models of bilingual processing, diagnosis of language disorders, and improved understanding of social factors of group membership and microaggressions. code-switching analysis contributes to the development of cognitive models for bilingual language processing and production @xcite @xcite . understanding the functions of code-switching is critical for speech-language pathologists interacting with bilingual children, so as not to mistakenly diagnose them with a language disorder when in reality, children are taking advantage of a wide range of communicative strategies by code-switching @xcite . studying codeswitching in people with dementia and alzheimer's disease can provide insights into language impairments experienced as their condition becomes more severe @xcite @xcite . code-switching is also important for pragmatics research of understanding social identities and group membership that speakers are trying to assert @xcite . because of political undertones of using one language over another @xcite , code-switching is useful for understanding linguistic microagressions @xcite . our contributions are the following: ## annotation we describe the data annotated, present our annotation scheme, and give a comparison of our annotation to previous annotation schemes. ## automatic detection of the code-switching functions results show the most effective approach is by building unique classifiers for each label. because over half of the labels appear in less than 10% of the data, we find that the classifiers always predict 0 for these labels if provided with all of the training data. thus, we create balanced training datasets for each label so that half of the examples are an instance of the label, and the other half are not. in addition to a baseline naive bayes classifier, we fine-tune bert-base-multilingual-cased (mbert) and xlm-roberta-base (xlm-roberta) classifiers using huggingface. 2 because of the rel- transcript gold system original: mar: that my children were being welcomed into theolvídate si tiene como tres trainers! tiene un cocinero! borrowing borrowing translation: mar: that my children were being welcomed into theforget it if he has like three trainers! he has a chef! original: jes: invita a a alguna de las celebraciones. nic: i don't know. i have jes: tú sabes se caen bien. nic: yeah i'll tell her. bueno not her i gotta tell sister. filler no filler translation: jes: invite [her] to one of the celebrations. nic: i don't know. i have jes: you know they like each other. nic: yeah i'll tell her. well not her i gotta tell sister. original: iri: ajá. jam: if if i happens to see like running blood or something like that i feel disgust and i feel weak and i iri: my dad was just the same. sí, sí, sí, sí, kryptonite. jam: kryptonite, yeah. iri: no mi pa mi papá era igual. translate translate translation: iri: uh huh. jam: if if i happens to see like running blood or something like that i feel disgust and i feel weak and i iri: my dad was just the same. yes, yes, yes, yes, kryptonite. jam: kryptonite, yeah. iri: no my da-my dad was the same. original: pai: en qué lo puedo ayudar? sar: he's going to the airport. pai: what up. sar: discúlpame. pai: it sounds like you're saying escúpame. no command command translation: pai: how can i help you? sar: he's going to the airport. pai: what up. sar: excuse me. pai: it sounds like you're saying spit me. training details and hyperparameters are in the appendix. we find the best model to be the xlm-roberta model. ## conclusion this paper presents a corpus of spanish and english code-switching with labels for the different functions for code-switching. we collect the data from the bangor miami corpus, create an annotation scheme for functions of code-switching, and annotate the data. we propose a classifier-based approach to detect the functions of code-switching in the annotated code-switching corpus. results show that the xlm-roberta model is the most effective at predicting functions of code-switching. we believe that analysis of functions of code-switching is an innovative approach towards bilingual speech diagnosis as well as contributing to a linguistic model of code-switching.