When multilingual individuals communicate, they frequently alternate between languages or scripts within a single conversation or social media post—a phenomenon known as code-switching. Traditional Natural Language Processing (NLP) pipelines often treat code-switching as a form of vocabulary noise or a syntax-breaking anomaly. However, a growing body of research demonstrates that code-switching is a structured, deliberate mechanism used to convey pragmatic intent and emotional nuance. Instead of being random, the act of switching languages itself serves as a critical communicative channel.
Functional Language Specialization
Why do speakers switch languages? In many multilingual communities, different languages are assigned distinct functional roles. The authors of Language Patterns and Behaviour of the Peer Supporters in Multilingual Healthcare Conversational Forums observe that in peer support settings, speakers often use formal or colonial languages (like English) to convey authoritative medical information, while reserving local dialects or slang (like Kiswahili and Sheng) for emotional expression and social bonding.
This division of labor is particularly evident during crises. For instance, Fermin Roberto Lapitan et al. demonstrate in Crowdsourcing-based Annotation of Emotions in Filipino and English Tweets that in disaster contexts, English is preferred for objective, official reporting, whereas the local language is deployed to express personal feelings and resilience. This social signaling is also visible structurally; David Jurgens et al. show in Twitter Users #CodeSwitch Hashtags! #MoltoImportante #wow that authentic code-switching on social media is heavily concentrated in hashtags that serve social or emotional functions, such as signaling community membership. Similarly, Olga Kellert et al. find in Where and How Do Languages Mix? A Study of Spanish-Guaraní Code-Switching in Paraguay that the indigenous language Guaraní acts as a marker of identity and intimacy in emotional and social interactions.
Signaling Emotional Polarity and Dialogue Acts
Code-switching does not just reflect static language preferences; the boundary where a switch occurs often signals a shift in communicative intent or emotional state.
Koustav Rudra et al. investigated this mathematically in Understanding Language Preference for Expression of Opinion and Sentiment: What do Hindi-English Speakers do on Twitter?. They found that a change in language frequently marks the exact boundary where a speaker transitions from a factual narrative to a personal evaluation or a negative sentiment. Furthermore, high emotional valence acts as a catalyst for these transitions; as shown by Innocent Ndubuisi-Obi et al. in Wetin dey with these comments? Modeling Sociolinguistic Factors Affecting Code-switching Behavior in Nigerian Online Discussions, increased passion or intensity often prompts speakers to depart from formal linguistic norms in favor of expressive local dialects.
This behavior is deeply tied to the underlying purpose of an utterance rather than its topic. Debasmita Bhattacharya et al. demonstrate in Discourse-Driven Code-Switching: Analyzing the Role of Content and Communicative Function in Spanish-English Bilingual Speech that the dialogue act (the pragmatic purpose of speech) exerts a stronger influence on code-switching patterns than the specific content or named entities being discussed. One prominent affective driver is empathy: Debasmita Bhattacharya et al. provide quantitative evidence in Switching Tongues, Sharing Hearts: Identifying the Relationship between Empathy and Code-switching in Speech that code-switched utterances are significantly more likely to be empathetic than monolingual ones across multiple language pairs.
Why It Works: Leveraging the Non-Dominant Channel
Understanding the functional nature of code-switching allows computational models to capture nuances that monolingual models miss. In a code-switched text, the secondary or non-dominant language often carries a disproportionate amount of emotional weight.
Yue Zhang et al. highlight this in A Bilingual Attention Network for Code-switched Emotion Prediction, noting that in Chinese-dominant social media posts, roughly 20% of the core emotional signals are concentrated specifically within English words. When models assume language choice and emotion are independent, they fail to capture this unique semantic environment where the overall emotional tone is greater than the sum of its parts. To exploit this, Zhongqing Wang et al. developed a bipartite graph-based label propagation model in Emotion Detection in Code-switching Texts via Bilingual and Sentimental Information to bridge the linguistic gap and capture how specific languages are selected to trigger emotional states.
This principle extends beyond different languages to different writing systems. Rong Xiang et al. show in Leveraging Writing Systems Change for Deep Learning Based Chinese Emotion Analysis that the deliberate act of switching scripts (e.g., mixing Chinese characters with Latin letters or emojis) serves as a stylistic choice that signals emotional state, even when the switched segments contain no explicit emotion words.
Improving Downstream NLP Applications
By treating code-switching as a feature rather than noise, models can dramatically improve their performance on complex pragmatic tasks like humor, sarcasm, and hate speech detection.
Srijan Bansal et al. demonstrate this in Code-Switching Patterns Can Be an Effective Route to Improve Performance of Downstream NLP Applications: A Case Study of Humour, Sarcasm and Hate Speech Detection. They show that specific structural patterns—such as embedding a single word from one language inside another—signal local switching dynamics that denote humor or emphasis. Furthermore, the frequency of switching acts as a macro-signal: while humorous content features rapid language transitions, sarcasm and hate speech typically involve longer, sustained blocks of a single language.
Similarly, non-linguistic markers can help predict these shifts. Evangelos E. Papalexakis et al. show in Predicting Code-switching in Multilingual Communication for Immigrant Communities that emoticons provide contextual cues that coincide with transitions between minority and majority languages. Finally, automated systems can reliably categorize these shifts; Jeffrey Flanigan et al. demonstrate in Automatic Identification of Code-Switching Functions in Speech Transcripts that transformer-based systems can accurately identify the underlying communicative intent (such as topic shifts or jokes) behind language alternation.
Key Foundational Work
Emotion Detection in Code-switching Texts via Bilingual and Sentimental Information (2015) — contributed 3 concept elements to this direction.
Predicting Code-switching in Multilingual Communication for Immigrant Communities (2014) — contributed 1 concept elements to this direction.
Twitter Users #CodeSwitch Hashtags! #MoltoImportante #wow (2014) — contributed 1 concept elements to this direction.