Tesseract and French: eng gets 2 accents in 5 wrong
98%
of accents right with -l fra
One flag: 59.8% to 97.9%
Proofread pages from 15 French books, printed 1845 to 1947:
| Model | Accents right | Words right |
|---|---|---|
-l eng, the default |
59.8% | 88.1% |
-l fra |
97.9% | 96.8% |
98.8% of letters right with eng, accents aside
11.9% of words wrong with eng
eng reads the letters fine. It loses the marks on top, and every word that holds one.
What eng does to French words
Real words from these scans. Each time, fra read it right:
| Printed | eng read | Times |
|---|---|---|
| à | a | 106 |
| même | méme | 26 |
| mère | mére | 19 |
| être | étre | 18 |
| où | ot | 15 |
à became a on 28 of 30 pages, so "to" turns into "has". And a search for même never finds méme.
Install fra, then pass -l fra
-
Debian or Ubuntu:
sudo apt install tesseract-ocr-fra -
macOS:
brew install tesseract-lang, all languages - Check:
tesseract --list-langsshows fra
This writes page.txt:
tesseract page.png page -l fra
In Python:
import pytesseract
print(pytesseract.image_to_string("page.png", lang="fra"))
Bigger models and mixes add little
Each against plain fra, which took 1.1 seconds a page:
| Setting | Accents right | Sec a page |
|---|---|---|
| fra from tessdata_best | 98.0% | 1.4 |
-l fra+eng |
95.4% | 1.7 |
-l eng+fra |
95.4% | 1.7 |
| script/Latin, for all Latin-alphabet languages | 95.3% | 2.0 |
Adding eng cost 57 or 58 accents, in either order. Use fra alone on French pages.
How I tested it
- Pages: fr.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.
- 30 pages, 61,826 letters, 2,285 of them with an accent (or œ, æ).
- Each scan is the wiki's page image: 18 at 1,920 px, 10 at 1,280 px, 2 at 960 px.
- Accents right: accented letters read right, in order. Words right: proofread words read right, accents and all, in order.
- Running heads and page numbers are not in the proofread text, so extra text costs nothing.
- fra+eng and eng+fra gave different text on 11 of 30 pages, but almost the same score.
- 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: set Language to French
Our Apify Actor reads scans with the same fra file. Its Language input starts at English. On these 30 scans, live build 0.1.44:
56.8% of accents right, left at English
93.0% set to French
Test build 0.1.52 keeps the one two-column page in order and gets 96.3% set to French. It is not the live build yet.
What I did not test
- Phone photos, faxes, and scans under 960 px wide.
- Books printed before 1800, with the long s.
- Handwriting. See this test.
- Other languages. Spanish and Portuguese 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 French?
Yes, with the fra model. On 30 proofread book scans it read 97.9% of accented letters right. The default eng read 59.8%.
Why does Tesseract drop French accents?
Usually it runs with eng, the default. On these scans eng read è as é 205 times and ê as é 134 times. Pass -l fra.
Is fra from tessdata_best worth it?
Barely, on these scans. It read 98.0% of accents right, and it took 1.4 seconds a page.