GlotScript: A Resource and Tool for Low Resource Writing System Identification

Amir Hossein Kargaran, François Yvon, Hinrich Schütze

Introduction

Language Identification (LID) is a fundamental task in Natural Language Processing, yet it remains a significant hurdle for low-resource languages. Data scarcity and high orthographic variability often lead to failures in traditional LID systems. While identifying a specific language is challenging, identifying the script (e.g., Cyrillic, Devanagari, or Latin) is a much more robust alternative for initial data filtering and quality control.

Despite the importance of script identification, existing tools are limited, typically covering only a few dozen scripts. Unicode 15.0, however, defines 161 distinct scripts. Furthermore, there has been no unified resource mapping these scripts to the over 7,000 languages spoken globally. GlotScript addresses this gap by providing a comprehensive metadata resource and a high-performance identification tool.

The GlotScript Framework

The authors introduce two core components designed to improve the handling of global linguistic diversity:

  1. GlotScript-R (The Resource): A metadata repository compiled from four major sources: LREC_2800, Wikipedia, ScriptSource (SIL), and LangTag (SIL). To manage discrepancies between these sources, scripts are categorized as CORE (supported by at least two sources or a consensus) or AUXILIARY (specified by only one source). This allows researchers to prioritize either strict accuracy or broad coverage.
  2. GlotScript-T (The Tool): A Python-based identification tool that maps text to ISO 15924 script codes. Unlike previous methods that rely on broad Unicode blocks, GlotScript-T uses a per-character approach to identify 161 scripts, including special categories like Zinh (inherited) and Zyyy (undetermined punctuation).

LLM Script Coverage and the "Token Tax"

One of the most striking applications of GlotScript is the analysis of Large Language Model (LLM) vocabularies. While models like GPT-4 are highly capable, their internal representations remain heavily biased toward Latin scripts.

Distribution of scripts in the vocabularies of various Large Language Models (LLMs).

As shown in the analysis, specialized models like Glot500 support up to 88 scripts, whereas GPT-4 includes representations for only 18. This disparity leads to a "tokenization tax": because LLM tokenizers are optimized for English, non-Latin scripts require significantly more tokens to represent the same meaning. For example, the same text in the Universal Declaration of Human Rights (UDHR) generates 10 times more tokens in Sinhala than in English when processed by GPT-4, effectively making the model 10x more expensive for Sinhala speakers.

Corpus Quality and the Script Mismatch Rule

GlotScript enables a powerful cleaning method known as the "Script Mismatch Rule." By verifying if a sentence's detected script matches the language label assigned in a corpus, researchers can identify significant "pollution" in web-crawled datasets like mC4 and OSCAR.

Script accuracy (ACC) and common script mismatches in the mC4 and OSCAR corpora.

The analysis reveals that low-resource data is disproportionately noisy. In the mC4 dataset, the average script accuracy for low-resource languages is only 0.566, compared to 0.917 for the dataset overall. A notable example is Welsh (cym), where many sentences were found to be written in Greek script—a clear sign of mislabeling in the original crawl.

Key Results and Efficiency

GlotScript-T is designed for scale, processing approximately 1 million sentences in 80 seconds on a single CPU core. This efficiency makes it feasible to audit massive datasets containing billions of tokens.

Beyond efficiency, the project highlights the systemic inequality in AI development. The reliance on Latin-centric tokenizers not only degrades performance for non-Latin languages but also imposes a direct financial burden on users from those linguistic communities.

Limitations and Future Work

While GlotScript-R is a major step forward, it is dependent on the accuracy of its underlying sources (Wikipedia, SIL). The "consensus risk"—where requiring multiple sources to agree might exclude rare but valid writing systems—is a known limitation. Future iterations aim to refine script labels into categories such as "live," "historic," or "romanization in use" to provide more granular guidance for dataset curators.

Resource Link: https://github.com/cisnlp/GlotScript

Summary updated

BibTeX
@inproceedings{kargaran2024glotscript,
  author = {Amir Hossein Kargaran and François Yvon and Hinrich Schütze},
  title = {{GlotScript: A Resource and Tool for Low Resource Writing System Identification}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
}
Figure