Tesseract and Czech: eng reads že as ze
99%
of Czech marked letters right with -l ces
One flag: 8.5% to 99.2%
Proofread pages from 15 scanned Czech books, printed 1869 to 1959:
| Model | Marked letters right |
Words right |
|---|---|---|
-l eng, the default |
8.5% | 54.5% |
-l slk, Slovak |
73.5% | 82.3% |
-l ces |
99.2% | 98.1% |
95.9% of letters right with eng, marks aside
47% of the words here hold a marked letter
Marked letters means the 15 Czech letters with a mark, from á to ž. eng has é and none of the rest, so every other one comes out bare.
What eng does to Czech words
Real words from these scans. Each time, ces read it right:
| Printed | eng read | Times |
|---|---|---|
| že | ze | 89 |
| když | kdyz | 24 |
| až | az | 21 |
| ještě | jesté | 19 |
| jenž | jenz | 16 |
eng printed é for 703 of the 744 ě here.
Slovak has no ě, ř or ů
Czech and Slovak share most marked letters, so slk looks like a fair stand-in. It is not: its model has no ě, ř or ů.
slk read 0 of the 1,450 ě, ř and ů on these pages. It printed č for 421 of the ě.
Install ces, then pass -l ces
-
Debian or Ubuntu:
sudo apt install tesseract-ocr-ces -
macOS:
brew install tesseract-lang, all languages - Check:
tesseract --list-langsshows ces
This writes page.txt:
tesseract page.png page -l ces
In Python:
import pytesseract
print(pytesseract.image_to_string("page.png", lang="ces"))
Plain ces is the one to use
Each against plain ces, which took 0.9 seconds a page:
| Setting | Marked letters right |
Sec a page |
|---|---|---|
| ces from tessdata_best | 99.4% | 2.0 |
-l ces+eng |
97.3% | 1.2 |
-l eng+ces |
97.2% | 1.2 |
| script/Latin, for all Latin-alphabet languages | 96.8% | 1.4 |
With eng added, ces+eng printed í as plain i 46 times, against 12 with ces alone. For Czech pages, leave eng out.
How I tested it
- Pages: cs.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 or tables were skipped.
- Each page has 100 or more marked letters, and 10 or more of ě, ř and ů. So Slovak and other pages stayed out.
- Each page passed a check that a model in no row above (eng 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,100 letters, 5,683 of them marked.
- Two pages are a two-column index from an 1895 law gazette. The shuffle picked them, so they stayed.
- Dates come from the wiki's page for each book.
- Each scan is the wiki's page image: 12 at 1,920 px, 14 at 1,280 px, 4 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 Czech option
Our Apify Actor reads scans with Tesseract too, but its Language input has no Czech. It starts at English. On these 30 scans, live build 0.1.44:
8.1% of marked letters right, left at English
61.8% of words right with Spanish, its best
Spanish has á, é, í, ó and ú, but no háček letter. For Czech scans,
use plain Tesseract with -l ces.
What I did not test
- Phone photos, faxes, and scans under 960 px wide.
- Books printed after 1959.
- Handwriting. See this test.
- Other languages. Polish, German and Ukrainian 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 Czech?
Yes, with the ces model. On 30 proofread scans it read 99.7% of all letters right, marks included.
Why does Tesseract drop the háček?
It runs with eng, the default. eng has é but none of the other 14 Czech marked letters, so ž comes out as z. Pass -l ces.
Is tessdata_best better for Czech?
Barely. ces from tessdata_best read 99.4% of the marked letters, against 99.2% for the fast model, and took more than twice as long.