Tesseract and Polish: eng turns się into sie
98%
of Polish letters right with -l pol
One flag: 0.0% to 97.8%
Proofread pages from 15 scanned Polish books, printed 1876 to 1938:
| Model | Polish letters right |
Words right |
|---|---|---|
-l eng, the default |
0.0% | 57.1% |
-l pol |
97.8% | 95.7% |
95.8% of letters right with eng, marks aside
42.9% of words wrong with eng
Polish letters here means ą, ć, ę, ł, ń, ó, ś, ź and ż. eng finds the letters, but its model has none of them. It prints ł as l or t, and ó as é.
What eng does to Polish words
Real words from these scans. Each time, pol read it right:
| Printed | eng read | Times |
|---|---|---|
| się | sie | 162 |
| że | ze | 67 |
| już | juz | 23 |
| które | ktére | 17 |
| który | ktéry | 16 |
się came out wrong on 30 of 30 pages.
ł is 1,117 of the 4,023 Polish letters here. eng printed 587 of them as l and 414 as t.
pol cannot print the old é
Each letter group, read right by pol:
| Letters | On the pages | pol right |
|---|---|---|
| ą ć ę ł ń ó ś ż | 3,985 | 97.9% |
| ź | 38 | 81.6% |
| é | 52 | 0% |
Older Polish print uses é, as in jéj and téj. The pol model has no é, so it prints ć or ó instead. Search for them when you proofread.
Install pol, then pass -l pol
-
Debian or Ubuntu:
sudo apt install tesseract-ocr-pol -
macOS:
brew install tesseract-lang, all languages - Check:
tesseract --list-langsshows pol
This writes page.txt:
tesseract page.png page -l pol
In Python:
import pytesseract
print(pytesseract.image_to_string("page.png", lang="pol"))
Bigger models gain little, mixes lose letters
Each against plain pol, which took 1.1 seconds a page:
| Setting | Polish letters right |
Sec a page |
|---|---|---|
| pol from tessdata_best | 98.0% | 1.7 |
-l pol+eng |
96.4% | 1.4 |
-l eng+pol |
96.1% | 1.5 |
| script/Latin, for all Latin-alphabet languages | 92.3% | 1.7 |
script/Latin read 48 of the 52 é, but it missed 105 ł, so it lost overall.
How I tested it
- Pages: pl.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 100 or more Polish letters, so pages in Latin, French or German stayed out.
- Each page passed a check that eng finds 80% of the wiki's letters on the scan, marks aside. So the wiki text is the text on the scan.
- 30 pages, 46,612 letters, 4,023 of them Polish letters.
- Dates come from the wiki's page for each book.
- Each scan is the wiki's page image: 20 at 1,920 px, 6 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 Polish option
Our Apify Actor reads scans with Tesseract too, but its Language input has no Polish. It starts at English. On these 30 scans, live build 0.1.44:
2.2% of Polish letters right, left at English
56.6% of words right
Spanish and Portuguese came closest: 10.1% of Polish letters, all of
them ó. They have ó, but no ą, ć, ę, ł, ń, ś, ź or ż. For Polish
scans, use plain Tesseract with -l pol.
What I did not test
- Phone photos, faxes, and scans under 960 px wide.
- Gothic (Fraktur) print. See the Fraktur test.
- Handwriting. See this test.
- Other languages. German, Turkish 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 Polish?
Yes, with the pol model. On 30 proofread scans it read 97.8% of the Polish letters right. The default eng read 0.0%.
Why does Tesseract print sie instead of się?
It runs with eng, the default, and eng has no ę. On these scans eng printed się as sie 162 times. Pass -l pol.
Can Tesseract read é in old Polish books?
Not with pol: its model has no é. script/Latin has it and read 48 of 52, but it read fewer of the other letters.