Abstract
Identifying languages in code-mixed text, such as "Hinglish" (Hindi-English), is a critical first step for downstream Natural Language Processing (NLP) tasks. This study evaluates various input representations—word, character, and sub-word units—across several neural architectures. Our findings reveal that sub-word representations consistently outperform other methods, with a Bi-LSTM model achieving a state-of-the-art accuracy of 94.52%.
Introduction
In multilingual societies, social media users frequently "code-mix," blending local languages with English (e.g., "ye to aam admi ka budget hai"). Standard NLP tools often struggle with this phenomenon. Language Identification (LID) aims to tag every token in a sentence with its correct language ID. This task is complicated by lexical ambiguity (e.g., "are" in English vs. Hindi), noisy social media data, and out-of-vocabulary (OOV) issues.
Methodology
The authors treat LID as a token classification task, testing three primary input representations against various neural architectures to find the optimal balance between granularity and semantic meaning.
Input Representations
- Word-based: Standard 300-dimensional embeddings.
- Character-based: A CNN processes words character-by-character to capture morphological patterns.
- Sub-word units: Using Google’s SentencePiece tokenizer to split words into logical chunks (e.g., "whatsapp" might become "what/_sapp"). This is the core focus of the study.
Architectures
The researchers evaluated "simple" architectures to ensure the LID module remains computationally efficient for pre-processing:
- CNN & Multi-CNN: 1D convolutions with varying filter sizes to capture local patterns.
- LSTM: A single-layer Bidirectional LSTM to capture long-range dependencies and context.
- Hybrid Models: Combining CNNs for character feature extraction with LSTMs for sequence modeling.
Datasets
The study utilizes the SAIL ICON 2017 code-mixed sentiment analysis dataset, sourced from Twitter and manually annotated. The dataset contains 12,936 training sentences and 5,525 test sentences, with a balanced distribution of approximately 110,000 tokens for both Hindi and English across the sets.
Key Results
Quantitative results demonstrate a clear performance hierarchy: Sub-word > Character + Word > Word.
The Sub-word + LSTM model emerged as the top performer, reaching 94.52% accuracy. Notably, sub-word representations outperformed word-based representations across every tested architecture (CNN, Multi-CNN, and LSTM). While adding character-level features (CharCNN+LSTM) improved accuracy over word-only models to 92.71%, it still trailed the sub-word approach.
Discussion
- The "Goldilocks" Granularity: Sub-words provide an ideal level of granularity, avoiding the specificity of words (prone to OOV errors) and the extreme fragmentation of characters.
- Robustness to Noise: Sub-word and character representations are more resilient to spelling variations common on social media (e.g., "gooood").
- Contextual Importance: The superior performance of LSTMs over CNNs highlights the necessity of surrounding context for resolving language ambiguity.
- Efficiency: By avoiding heavy architectures like Transformers, the authors provide a lightweight "gatekeeper" suitable for real-time pre-processing.
Conclusion and Future Work
While sub-word units show great promise, the study identifies areas for refinement, such as exploring loss masking for "dummy" labels assigned to trailing sub-word tokens. Future research is also needed to expand these findings to other Indian language pairs, which currently suffer from a lack of standardized, high-quality datasets.
Summary updated