Authors: Jörg Tiedemann, Nikola Ljubešić
Source: Proceedings of COLING 2012.
2012.
Abstract
Distinguishing between closely related languages like Bosnian, Croatian, and Serbian (BCS) is a notorious "hard mode" for standard language identifiers. This paper demonstrates that while general-purpose tools struggle with the high lexical overlap of BCS, simple token-based models and a specialized "Blacklist" classifier—trained on parallel corpora—can boost identification accuracy from roughly 87% to a staggering 97%.
The Challenge of Closely Related Languages
Language Identification (LI) is often considered a solved problem in Natural Language Processing. For distinct languages, such as English versus Chinese, character n-gram models are exceptionally effective. However, these models frequently fail when confronted with "closely related languages"—varieties that share a common origin, high mutual intelligibility, and significant vocabulary overlap.
The authors focus on the Bosnian-Croatian-Serbian (BCS) complex. These languages are linguistically similar enough that they were once treated as a single standard (Serbo-Croatian), yet they possess distinct codified standards today. Standard tools often confuse them, particularly Bosnian, which occupies a middle ground by mixing features from both Croatian and Serbian. Accurate identification is critical for building clean web corpora and providing localized services for millions of speakers.
Baseline Performance of General Tools
General-purpose language identifiers struggle significantly with the BCS complex. As shown in the confusion matrices below, tools like TextCat and Lingua::Identify perform poorly, with TextCat achieving only 55.5% overall accuracy. Even langid.py, a more modern baseline, reaches only 87.7%, largely due to confusion between Bosnian and the other two varieties.
Proposed Methodology
The authors move away from standard character-level approaches, proposing two token-based (word-based) strategies:
- Multinomial Naive Bayes (MNB) Classifier: By training on parallel corpora (the same text translated into all three languages), the model learns to ignore shared content and focus strictly on the lexical choices that differ between the languages.
- The "Blacklist" Classifier: This novel approach identifies "indicator features"—words common in one language but rare or forbidden in another. Using a unique ratio ($\delta$) to weight words based on frequency differences across language pairs, the model performs a form of "heavy feature selection." For example, it might focus on Croatian's unique month names (e.g., listopad) versus the international versions used in Serbian (e.g., oktobar).
Experimental Setup and Results
The models were trained on the SETimes corpus, a trilingual parallel dataset of news articles. Evaluation was conducted on a manually verified set of 600 documents (200 per language) scraped from online news sources like Dnevni Avaz (Bosnian), Večernji list (Croatian), and Politika (Serbian).
The improvement over state-of-the-art general tools was substantial. The proposed Blacklist Classifier achieved 97% overall accuracy, while the Naive Bayes model reached 95.7%.
The "Bosnian Problem"
Bosnian remains the most difficult to identify because it is a "mixture" language. It often follows Croatian's ijekavian reflex (e.g., dijete vs. Serbian dete) but shares other lexical traits with Serbian. General tools often had accuracy as low as 32-45% for Bosnian. However, by using parallel data as a "cheat code," the models can perform a natural subtraction of identical content, leaving only the linguistic markers. Accuracy for Bosnian jumped from 69.5% in the best baseline to 93.5% with the Blacklist classifier.
Conclusion
While character n-grams are robust for general tasks, token-based models have a much higher performance ceiling for related languages because they capture specific morphological and vocabulary-standard differences. The study finds that these models become highly reliable (over 90% accuracy) once a document reaches approximately 70 tokens, though the difficult task of Bosnian identification requires 150–200 words for high confidence.
Summary updated