Fine-Tuned Tesseract Reads Mansi Text: Character Errors Drop from 18.5% to 0.85%
The Ugra Research Institute of Information Technologies fine-tuned Tesseract 5 on the Mansi language. The base Russian model confused letters with a macron and got 18.5% of characters wrong. Instead of manually annotating scans, the team generated 1.3 million lines synthetically, and errors fell to 0.85%. The model is open on Hugging Face.
AI-processed from Habr AI; edited by Hamidun News
Imagine you need to digitize thousands of pages in a language with no ready-made OCR and no annotated scans. This is exactly what researchers at the Ugra Research Institute of Information Technologies faced while building a corpus of the Mansi language. Their solution turned out to be surprisingly down-to-earth and yet very effective: the share of erroneous characters dropped from 18.5% to 0.85%, roughly a 20-fold improvement.
What the problem was
Mansi writing is based on Cyrillic, but it contains long vowels with a macron (а̄, о̄, ӯ, э̄, ы̄) and the letter ӈ. The standard Russian Tesseract model does not know these characters. It drops the bar above the letter or turns it into garbage. And vowel length in Mansi changes the meaning of a word, so losing the macron means losing information.
Take the line "Хӯл тэ̄нутыг ва̄рнэ ма̄гыс": the Russian model produced "Хул тэнутыг варнэ магьгсь". The macrons vanished, and "ы" turned into "ьг". The fine-tuned model read the entire line without a single error.
There is also a second, less obvious problem. The same letter in Unicode can be written in different ways: as a single precomposed character or as "у" plus a combining macron. To a human they look identical, but to a model and to string comparison they are different sequences. Just open a Python console: the length of two visually identical "ӯ" will be 1 and 2, and the comparison will return False.
How the data was collected without scans
Ready-made Mansi scans of sufficient volume do not exist, and annotating them manually would take years. So the team generated the data itself: it takes real Mansi text, renders it as an image in various fonts, and the correct answer is known in advance.
The pipeline consists of four steps:
- All texts are normalized to Unicode form NFC so that each letter has exactly one representation.
- Lines are rendered in several dozen typefaces, including FreeSerif, DejaVu Sans, Arial and Times New Roman, at sizes of 12, 14, 24 and 26 pt and in three styles.
- Each character is labeled with a bounding box. Automatic calculation from font metrics makes mistakes on diacritics, so the authors introduced three correction dictionaries: for individual characters, for font size, and for a specific typeface. The values were chosen experimentally.
- Long text is cut by the split_by_width function so that no character extends beyond the edge of the image.
The output was 1.3 million pairs of ".tif image + .gt.txt file with the correct answer".
How Tesseract was fine-tuned
The third part of the recipe is transfer learning. Inside Tesseract 5 runs a CRNN: the convolutional part finds strokes and bars, the LSTM reads the features from left to right, and the CTC loss function removes the need for manual annotation of letter boundaries. The starting point was rus.traineddata from tessdata_best. The Mansi alphabet almost coincides with the Russian one, so the model mostly has to learn the new letters.
The tesstrain tool itself extracts the LSTM part with its weights, collects the full list of characters from the training data, and expands the output layer to the combined alphabet. The key parameter turned out to be the number of iterations: too few and the new letters are not learned, too many and the model overfits to the synthetic data. Early stopping on a validation set helped.
The resulting metrics: CER fell from 18.5% to 0.85%, and WER from 42.1% to 1%. A person is left to proofread the result rather than retype the text from scratch.
Limitations and practical takeaway
The model confidently reads clean typographic text in 12–26 pt. It performs worse with very small or very large type, with Latin script, and with old editions with worn print. The authors plan to add real archival scans to training. It is also worth noting that the evaluation was done under the same synthetic conditions, so on real books the figures are likely to be worse.
The recipe itself is useful for practitioners. If you work with a language or domain with little annotated data:
- First normalize Unicode; it is a cheap and often underrated measure.
- Generate synthetic data from real texts with a variety of fonts.
- Fine-tune an existing model rather than training from scratch.
The authors believe the same approach will suit Khanty, Nenets and other Cyrillic languages with diacritics. The mns.traineddata model is available on Hugging Face (URIIT/mns-tesseract): just put the file in the tessdata folder and specify the language mns. You can also try it in the browser on Etnoportal.
- May 2, 2026Using AI to Process Customer Complaints: The Epotos Case Study
- Nov 9, 2026Tesseract lets AI agents edit 3D scenes while preserving objects and layers
- Jul 23, 2026Google Quantum AI: Reinforcement Learning Triples Stability of the Willow Quantum Chip
- Nov 9, 2026Mirage gives Claude tools to create and edit 3D scenes within a single project
Key Questions Answered
What the problem was?
Mansi writing is based on Cyrillic, but it contains long vowels with a macron (а̄, о̄, ӯ, э̄, ы̄) and the letter ӈ. The standard Russian Tesseract model does not know these characters. It drops the bar above the letter or turns it into garbage. And vowel length in Mansi changes the meaning of a word, so losing the macron means losing information. Take the line "Хӯл тэ̄нутыг ва̄рнэ ма̄гыс": the Russian model produced "Хул тэнутыг варнэ магьгсь". The macrons vanished, and "ы" turned into "ьг".
How the data was collected without scans?
Ready-made Mansi scans of sufficient volume do not exist, and annotating them manually would take years. So the team generated the data itself: it takes real Mansi text, renders it as an image in various fonts, and the correct answer is known in advance. The pipeline consists of four steps: All texts are normalized to Unicode form NFC so that each letter has exactly one representation.
How Tesseract was fine-tuned?
The third part of the recipe is transfer learning. Inside Tesseract 5 runs a CRNN: the convolutional part finds strokes and bars, the LSTM reads the features from left to right, and the CTC loss function removes the need for manual annotation of letter boundaries. The starting point was rus.traineddata from tessdata_best. The Mansi alphabet almost coincides with the Russian one, so the model mostly has to learn the new letters.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.