On social media, digital communication is rarely monolingual. In multilingual societies, users fluidly alternate between languages within a single post—a phenomenon known as code-mixing or code-switching. For instance, a tweet might combine Hindi vocabulary with English grammar, typed entirely in the Roman script (Hinglish), or blend Tamil and English expressions.
While natural for humans, code-mixed text breaks the fundamental assumptions of standard Natural Language Processing (NLP) pipelines. Traditional sentiment analysis models are optimized for monolingual text with rigid grammatical structures. When confronted with interwoven syntaxes, phonetic transliterations, and non-standard morphology, their performance degrades significantly. To solve this, researchers have shifted away from simple translation-based pre-processing toward architectures that natively model the unique pragmatic and structural properties of code-mixed language.
Why Translation Fails: The Pragmatics of the Switch
A naive approach to code-mixed sentiment analysis might involve translating the text into a single target language (like English) before applying a standard classifier. However, this pipeline strips away the most critical signal: the act of switching itself.
Code-switching is not random; it serves specific pragmatic functions that directly correlate with emotional expression. In Understanding Language Preference for Expression of Opinion and Sentiment: What do Hindi-English Speakers do on Twitter?, Koustav Rudra et al. discovered that Hindi-English bilinguals on Twitter exhibit a distinct "language of the heart," overwhelmingly preferring their native language (Hindi) to express negative sentiments and profanity, while utilizing English for more neutral or positive discourse.
When a user switches languages mid-sentence, the boundary often marks a shift in emotional polarity or intensity. As noted in FeedForward at SemEval-2024 Task 10: Trigger and sentext-height enriched emotion analysis in multi-party conversations, processing code-mixed language directly in its native form preserves these vital cultural and linguistic nuances that translation pipelines inevitably erase.
Handling the Noise: Sub-words and Linguistic Features
Beyond pragmatics, code-mixed text presents severe surface-level challenges. Because users type regional languages using the Latin alphabet (transliteration), there is no standardized spelling. A single word can be spelled dozens of ways based on phonetic interpretation.
To handle this morphological chaos, models must look below the word level. Asrita Venkata Mandalam and Yashvardhan Sharma demonstrated in Sentiment Analysis of Dravidian Code Mixed Data that sub-word level modeling and specialized word embeddings are highly effective for Dravidian code-mixed data (such as Tamil and Malayalam), allowing models to capture semantic similarities despite inconsistent spelling.
Alternatively, incorporating explicit linguistic features can compensate for the lack of clean syntactic structure. Elizabeth Bear et al. showed in TueMix at SemEval-2020 Task 9: Logistic Regression with Linguistic Feature Set that a simpler machine learning model leveraging a rich, engineered linguistic feature set could outperform deep neural networks on Hindi-English tweets. This proves that explicitly guiding a model with code-mixing patterns is often more powerful than expecting a neural network to infer them blindly from noisy text.
Grounded Learning: Multi-Tasking and Span Extraction
One of the most powerful intuitions in code-mixed NLP is that a model cannot accurately judge what an emotion is without understanding where and how the constituent languages interact.
To exploit this, researchers use multi-task learning frameworks. Chenghao Huang and Qi Wu designed a multi-task framework in MeisterMorxrc at SemEval-2020 Task 9: Fine-Tune Bert and Multitask Learning for Sentiment Analysis of Code-Mixed Tweets that simultaneously identifies the language of each token and predicts the overall emotion. By forcing the model to learn the underlying language-switching structure, it gains a better contextual grasp of the emotional intent.
Taking this a step further, the authors of Span Extraction Aided Improved Code-mixed Sentiment Classification introduced a bidirectional connection between sentiment classification and span extraction. Instead of just outputting a positive or negative label, their model simultaneously extracts the specific phrases (or "spans") that carry the sentiment. The intuition is elegant: teaching a model why a sentence expresses a sentiment directly improves its ability to decide if it does, grounding the classification in the actual code-mixed phrases responsible for the emotion.
The Promise and Limits of Multilingual Transformers
State-of-the-art approaches heavily rely on massive, pre-trained multilingual language models like mBERT, XLM-RoBERTa, and Language-agnostic BERT Sentence Embeddings (LaBSE). As demonstrated in LucasHub@Dravidian-CodeMix-FIRE2020: Sentiment Analysis on Multilingual Code Mixing Text with M-BERT and XLM-RoBERTa by Yang Bai and in WordWizards@DravidianLangTech 2024: Sentiment Analysis in Tamil and Tulu using Sentence Embedding by Shreedevi Balaji et al., these models provide a strong baseline because they map multiple languages into a shared semantic space, allowing the model to bridge the gap between mixed vocabularies.
However, these models are not a silver bullet. Because they are primarily pre-trained on formal, monolingual corpora (like Wikipedia), they still suffer from a significant performance gap when faced with real-world social media noise. When Ishani Mondal et al. evaluated these architectures in Language Patterns and Behaviour of the Peer Supporters in Multilingual Healthcare Conversational Forums, they found that state-of-the-art transformer models frequently fail to interpret pragmatic switches, sarcasm, or context-heavy negations in informal digital conversations.
Consequently, the field continues to evolve toward specialized fine-tuning strategies, multi-task grounding, and low-resource adaptation to ensure that AI can truly understand the nuanced, hybrid ways humans communicate online.