Skip to content
Florin Todor
English
Download CV (Spanish)
← All projects

Automatic language classifier based on bigrams

2023 AlgorithmsLanguage processing

A C++ system that models each language by the frequency of its character pairs and classifies an unknown text by measuring its distance to the known models.

Demo

What it does

  • A language model as a bigram profile, serialised to its own .bgr format
  • Classification by distance between models: it gets Spanish, English, French and German right on real literary texts
  • Clean separation: the right language lands at about 0.08 distance and the rest above 0.21
  • Manual dynamic memory management, with no STL containers
  • A BigramCounter class with matrix counting for efficient tallying
  • Incremental development over six iterations (Language0 → Language5)