Tesseract and Ukrainian: rus reads і as 1
92%
of Ukrainian letters right with -l ukr
One flag: 0.0% to 91.6%
Proofread pages from 15 scanned Ukrainian books, printed 1876 to 1960:
| Model | Ukrainian letters right |
Words right |
|---|---|---|
-l eng, the default |
0.0% | 0.0% |
-l rus |
0.0% | 63.3% |
-l ukr |
91.6% | 91.0% |
89.9% of all letters right with rus
36.7% of words wrong with rus
Ukrainian letters here means і, ї, є and ґ, the four that Russian does not have. eng has no Cyrillic at all. rus reads the other letters, but its model has none of these four.
What rus does to Ukrainian words
Real words from these scans. Each time, ukr read it right:
| Printed | rus read | Times |
|---|---|---|
| він | вн | 28 |
| від | вд | 25 |
| їх | 1х | 19 |
| під | шд | 16 |
| тільки | тльки | 15 |
rus printed the digit 1 for 427 of the 2,140 і here.
ukr misses the old ї, and has no ґ
Four books here, printed 1894 to 1913, use an older spelling with ї after consonants, as in поцїлувала. Today it is поцілувала.
| Pages | ї on them | ukr right |
|---|---|---|
| Modern spelling, 22 pages | 219 | 97.7% |
| Older spelling, 8 pages | 264 | 35.6% |
ukr prints most of the old ї as і. And no model I tested has ґ, so ukr printed most ґ as г. Search for both when you proofread.
Install ukr, then pass -l ukr
-
Debian or Ubuntu:
sudo apt install tesseract-ocr-ukr -
macOS:
brew install tesseract-lang, all languages - Check:
tesseract --list-langsshows ukr
This writes page.txt:
tesseract page.png page -l ukr
In Python:
import pytesseract
print(pytesseract.image_to_string("page.png", lang="ukr"))
script/Cyrillic reads the old ї better
Each against plain ukr, which took 0.9 seconds a page:
| Setting | Ukrainian letters right |
Sec a page |
|---|---|---|
| ukr from tessdata_best | 91.6% | 2.1 |
-l ukr+eng |
90.1% | 1.4 |
-l ukr+rus |
88.0% | 1.4 |
| script/Cyrillic, for all Cyrillic-alphabet languages | 93.5% | 0.9 |
script/Cyrillic read 76.1% of the old ї, but it missed more є, so it read fewer words. For books in the older spelling, try it.
How I tested it
- Pages: uk.wikisource scans whose text was proofread (level 3) or also checked by a second person (level 4). Books picked by a seeded shuffle, not by me, 2 pages a book. Pages with notes, poems, tables or columns were skipped.
- Each page has 50 or more of і, ї, є and ґ, and none of ы, э, ъ, ё or ѣ. So Russian pages and the oldest spellings stayed out: 18 pages for those letters.
- Each page passed a check that a model in no row above (script/Cyrillic from tessdata_best) finds 80% of the wiki's letters on the scan, marks aside. So the wiki text is the text on the scan.
- 30 pages, 42,431 letters, 2,857 of them Ukrainian letters.
- Older spelling: 10 or more ї right after a consonant in the wiki's text. The other pages have 2 or fewer.
- Dates come from the wiki's page for each book.
- Each scan is the wiki's page image: 16 at 1,920 px, 8 at 1,280 px, 6 at 960 px, never wider than the scan itself.
- Running heads and page numbers cost nothing.
- Tesseract 5.5.4, one thread. Models from tessdata_fast 4.1.0, the files Homebrew installs, and tessdata_best 4.1.0.
Our Actor has no Ukrainian option
Our Apify Actor reads scans with Tesseract too, but its Language input has no Ukrainian. It starts at English. On these 30 scans, live build 0.1.44:
0.0% of letters right, left at English
63.1% of words right with Russian
English prints no Cyrillic. Russian reads the rest, but none of і, ї,
є or ґ. For Ukrainian scans, use plain Tesseract with
-l ukr.
What I did not test
- Phone photos, faxes, and scans under 960 px wide.
- Books printed after 1960.
- Handwriting. See this test.
- Other languages. Russian, Polish and Greek have their own tests.
- Windows and Linux. One Mac.
Sources
Two ways to skip the work
Run it yourself. Our Apify Actor turns scanned PDFs into Markdown, tables included.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.
Questions people ask
Does Tesseract read Ukrainian?
Yes, with the ukr model. On 30 proofread scans it read 98.3% of all letters right. Russian (rus) misses every і, ї, є and ґ.
Why does Tesseract print 1 instead of і?
It runs with rus, and rus has no і. On these scans rus printed the digit 1 for і 427 times. Pass -l ukr.
Can Tesseract read ґ?
Not with the models I tested: ukr, ukr best and script/Cyrillic have no ґ. ukr printed 6 of the 9 ґ here as г.