Abstract
We present a simple method for language independent and task independent text categorization learning, based on character-level n-gram language models. Our approach uses simple information theoretic principles and achieves effective performance across a variety of languages and tasks without requiring feature selection or extensive pre-processing. To demonstrate the language and task independence of the proposed technique, we present experimental results on several languages---Greek, English, Chinese and Japanese---in several text categorization problems---language identification, authorship attribution, text genre classification, and topic detection. Our experimental results show that the simple approach achieves state of the art performance in each case.
Introduction
Traditional text categorization typically relies on a pipeline of manual feature engineering followed by machine learning. This approach faces three significant hurdles. First, it is highly language-dependent; tools like stemmers or stop-word lists must be tailored to each language, and Asian languages like Chinese and Japanese require complex word segmentation. Second, it is task-dependent; features that identify an author (stylistic markers) differ from those that identify a topic (keywords). Finally, standard feature selection often discards the "long tail" of infrequent features, which in linguistics can carry substantial information.
This paper explores a "universal" classifier that circumvents these issues by operating directly on raw text using character-level $n$-gram language models.
Methodology
The proposed method treats documents as raw sequences of characters rather than "bags of words." For each category, a separate $n$-gram language model is trained. Classification of a new document $D$ is performed by calculating the likelihood of the character sequence under each category's model using Bayesian decision theory. The document is assigned to the category with the highest likelihood (or lowest entropy).
The Role of Smoothing
A critical challenge in $n$-gram modeling is data sparsity—unseen character sequences in test data would result in zero probability without smoothing. The authors evaluated four techniques: Absolute, Good-Turing, Linear, and Witten-Bell smoothing.
As shown in Figure 3, the choice of smoothing method and the order $n$ significantly impact performance. Interestingly, while some methods like Good-Turing are traditionally preferred for minimizing perplexity, Witten-Bell smoothing consistently yielded the highest classification accuracy across tasks. This suggests that the best language model for prediction is not necessarily the best for classification.
Experimental Results
The approach was tested on a diverse set of benchmarks, including language identification (6 languages), Greek authorship and genre classification, and topic detection in English (20 Newsgroups), Chinese (TREC-5), and Japanese (NTCIR-J1).
Figure 4 illustrates the overall accuracy across these varied tasks and languages. The model achieved 100% accuracy in language identification with bi-grams and reached 90% accuracy in Greek authorship attribution, far exceeding the previous state-of-the-art of 72%. In English topic detection, it peaked at 89% accuracy, outperforming complex systems combining SVMs and error-correcting codes. Notably, the model achieved over 80% accuracy on Chinese and Japanese topic detection without any specialized word segmentation or morphological analysis.
Discussion and Conclusion
By working at the character level, the model naturally captures morphology (prefixes, suffixes) and stylistic habits while remaining robust to noise like typos. It avoids the errors inherent in word segmentation for Asian languages. However, the authors note that as $n$ increases, models become large and prone to overfitting on small datasets. Future work includes incorporating category priors for imbalanced datasets and extending the method to sentiment analysis and multi-label classification.
The simplicity of this character-level approach, combined with its state-of-the-art performance across languages and tasks, suggests that complex feature engineering is often unnecessary for effective text categorization.
Summary updated