Views
No views yet
tesseract -l tat is a different script — use it only for Latin Tatar.
The bundled tat model is Latin-script (Jaꞑalif-era), so it's the right choice for historical
Latin/Jaꞑalif Tatar — but on modern Cyrillic Tatar it produces garbage. This model
(tat_cyrl) is the Cyrillic counterpart, fine-tuned from the Russian (rus) model.yasalma/tatar-ocr-benchmark
(151 real document pages, region-level, micro-averaged CER):| Category | CER | WER |
|---|---|---|
| books | 1.84 % | 7.7 % |
| legal | 2.78 % | 8.9 % |
| periodicals | 3.45 % | 12.6 % |
| misc* (web/graphics/forms)† | 18.4 % | 27.9 % |
| Overall | 2.84 % | 10.0 % |
misc is a catch-all of non-prose pages — web/news link lists, certificates & posters,
tables/forms — typically full of Latin URLs and decorative fonts; see Intended use & limitations below.| input | CER | WER |
|---|---|---|
| clean print | 0.73 % | 5.7 % |
| scan-degraded | 3.10 % | 13.7 % |
BENCHMARK.md for details, caveats, and a head-to-head
against PP-OCRv5 (cyrillic) and Marker/Surya.1# put tat_cyrl.traineddata in a tessdata directory
2export TESSDATA_PREFIX=/path/to/dir/containing/tat_cyrl.traineddata
3tesseract page.png stdout -l tat_cyrl --psm 3 # full page
4tesseract line.png stdout -l tat_cyrl --psm 7 # single line1import pytesseract
2from PIL import Image
3text = pytesseract.image_to_string(Image.open("page.png"), lang="tat_cyrl", config="--psm 3")rus (Russian) tessdata_best model, which provides a
strong Cyrillic foundation; we extend the character set with the six Tatar letters and adapt to
Tatar typography and real-scan noise.tat_cyrl_a)gen_synth.py: render corpus text as line images in 20 Tatar-capable fonts (each verified via
the font cmap to actually encode ә ө ү җ ң һ — not just render tofu), with light augmentation
(blur, ±1.3° rotation, background/contrast jitter). 16 000 line/ground-truth pairs.fine_tune.sh: tesstrain fine-tune rus → tat_cyrl_a (char-set extension via
--continue_from/--old_traineddata). Converges to ~0.5 % CER on the synthetic set.tat_cyrl)data/real_lines/): 2 550 real line-image + ground-truth pairs extracted
from born-digital Tatar PDFs via their text-layer line coordinates (PyMuPDF), cleaned of soft
hyphens — real publisher fonts with perfect labels, the same typography as real scans.build_train_data.py: build a 12 650-line mix = real lines × (1 clean + 2 scan-degraded) +
5 000 scan-degraded synthetic lines. Degradation models real scans: blur, Gaussian noise, JPEG
artifacts, grey aged-paper background, ±1.6° skew, and ink erosion/dilation.fine_tune2.sh: continued fine-tune tat_cyrl_a → tat_cyrl on the mix (15 k iter, LR 5e-4).training/build_tess.sh # build Tesseract 5.5 + training tools from source
training/gen_synth.py # 16k synthetic line images (from your Tatar text corpus)
training/fine_tune.sh # stage A: rus -> tat_cyrl_a
training/build_train_data.py # 12.6k real+augmented mix (consumes data/real_lines/)
training/fine_tune2.sh # stage B: tat_cyrl_a -> tat_cyrl
eval/cer.py # line-level CER/WER on a held-out setocr/clean_boilerplate.py is a post-OCR cleanup utility: line-level removal of imprint/colophon,
table-of-contents, page numbers, and garbled URL/code lines, keeping prose — useful for tidying
model output before downstream use.misc bucket scores ~18 % CER while
books / periodicals / legal stay ≤3.5 %. That bucket is a catch-all of, for example:rus
tessdata_best model; the training/eval/OCR scripts in this repo are released under Apache-2.0.1@misc{tat_cyrl_2026,
2 author = {Ilshat Saetov},
3 title = {tat_cyrl: a Tesseract OCR model for Cyrillic Tatar},
4 year = {2026},
5 note = {Fine-tuned from Tesseract rus; synthetic + real book lines with scan augmentation},
6 url = {https://huggingface.co/yasalma/tatar-ocr-tesseract}
7}