Unicode Normalization and Grapheme Parsing of Indic Languages

Nazmuddoha Ansary, Quazi Adibur Rahman Adib, Tahsin Reasat, Asif Shahriyar Sushmit, Ahmed Imtiaz Humayun, Sazia Mehnaz, Kanij Fatema, Mohammad Mamun Or Rashid, Farig Sadeque

Processing Indic languages like Hindi, Bangla, or Tamil presents a unique challenge for computer scientists. Unlike the linear, "one-letter-after-another" nature of the Latin alphabet, Indic scripts are Abugidas. They rely on complex graphemes (or aksaras) where consonants, vowel diacritics, and consonant conjuncts stack vertically and horizontally to form a single visual unit.

A new paper presented at LREC-COLING 2024, "Unicode Normalization and Grapheme Parsing of Indic Languages," tackles the messy reality of how these scripts are encoded in Unicode and offers a more robust way to handle them.

TL;DR

The authors introduce two high-performance libraries: a Unicode normalizer that fixes pervasive encoding inconsistencies in Indic scripts and a grapheme parser that deconstructs words into visually distinct syllables. These tools significantly outperform existing baselines in both processing speed and downstream NLP accuracy, especially when dealing with "noisy" web text.

What Problem Does This Paper Address?

While we see a single character on screen, Unicode often represents that character as a sequence of multiple codes. In Abugida scripts, this leads to a "many-to-one" problem: there are often multiple valid (and invalid) ways to encode the same visual glyph.

For example, a "nukta" (a small dot diacritic) can be encoded as part of a precomposed character or as a separate trailing character. This ambiguity leads to "broken" text rendering, confuses search engines, and degrades the performance of machine learning models. Existing tools, like the widely used IndicNLP library, often fail to catch these subtle encoding errors, particularly in "noisy" data scraped from the internet.

Figure 1: Comparison of linear English text vs. non-linear Abugida scripts.

Methods

The authors propose a two-pronged solution:

  1. A Novel Unicode Normalizer: This tool identifies and fixes seven specific types of prevalent errors, including legacy symbol handling, broken vowel diacritics, and "invalid connectors" (characters like the Hoshonto or Halant appearing where they shouldn't). It even includes language-specific logic, such as handling unique Bangla conjuncts.
  2. A High-Performance Grapheme Parser: This algorithm deconstructs words into their constituent orthographic syllables. It uses a rule-based approach to identify "connectors" and group characters into visually sequential units. The authors provide a mathematical proof for the parser's accuracy across different scripts.

Datasets

The researchers evaluated their tools using:

  • OSCAR Corpus: A massive multilingual crawled dataset used to test the normalizer on real-world "noisy" internet text across seven languages (Bangla, Devanagari, Gujarati, Odiya, Tamil, Punjabi, and Malayalam).
  • Bangla NER Dataset: A multi-class Named Entity Recognition dataset (66k+ sentences).
  • Hindi Sentiment Analysis (HSA) Dataset: A dataset of 4,705 sentences used to measure how normalization affects downstream classification tasks.

Key Insights and Ideas

  • The "Noise" is Significant: In the Punjabi portion of the OSCAR corpus, a staggering 31.55% of unique words were found to be unnormalized. This highlights how much "garbage" exists in current training data for Indic LLMs.
  • Normalization as a Defense: The authors performed "stress tests" by injecting random encoding noise into datasets. Their normalizer acted as a robust shield, allowing models to maintain high performance even when the input was intentionally mangled.
  • Efficiency Matters: Grapheme parsing is often a bottleneck in text pipelines. By optimizing the logic for how connectors are identified and merged, the authors created a parser that is significantly faster than previous state-of-the-art syllabifiers.

Key Results

  • NLP Performance: On the Bangla NER task, using the proposed normalizer on noisy data allowed the model to retrieve a consistent F1-score of 0.89, whereas the IndicNLP baseline dropped as low as 0.75 under high noise.
  • Speedup: The grapheme parser is orders of magnitude faster than the IndicNLP syllabifier across all tested languages.
Figure 2: Time taken for our parser to process examples vs. time taken by IndicNLP syllabifier. Time is shown as a logarithmic function, and the example count is in scale of 106.

Limitations and Future Work

Despite the improvements, the authors acknowledge a few hurdles:

  • Normalizer Runtime: Because the normalizer handles many complex heuristic cases, it currently has a higher runtime than simpler, less effective versions. The authors plan to implement Just-In-Time (JIT) compilation via Numba to optimize this.
  • Word-Level Only: The current module works on separate words and does not yet normalize punctuation with "rigorous certainty."
  • Rare Conjuncts: While highly effective for common text, the algorithm might still struggle with extremely rare or archaic consonant conjuncts in languages other than Bangla.

The source code for these libraries is available on GitHub, providing a much-needed foundation for researchers building more reliable NLP tools for the 1.3 billion speakers of Indic languages.

Summary updated

BibTeX
@inproceedings{ansary2024unicode,
  author = {Nazmuddoha Ansary and Quazi Adibur Rahman Adib and Tahsin Reasat and Asif Shahriyar Sushmit and Ahmed Imtiaz Humayun and Sazia Mehnaz and Kanij Fatema and Mohammad Mamun Or Rashid and Farig Sadeque},
  title = {{Unicode Normalization and Grapheme Parsing of Indic Languages}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
}
Figure