Tesseract and Vietnamese: eng reads 1 word in 8 right
94%
of Vietnamese marks right with -l vie
One flag: 6.1% to 93.6%
Proofread pages from 15 Vietnamese books, printed 1914 to 1971:
| Model | Marks right | Words right |
|---|---|---|
-l eng, the default |
6.1% | 12.2% |
-l vie |
93.6% | 85.3% |
87.4% of letters right with eng, marks aside
87.8% of words wrong with eng
eng finds the letters, but its model has no ă, â, ê, ô, ơ, ư or đ, and é is its only toned letter. It prints ê as e, â as a and ơ as o.
What eng does to Vietnamese words
Real words from these scans. Each time, vie read it right:
| Printed | eng read | Times |
|---|---|---|
| mà | ma | 96 |
| có | cé | 73 |
| thì | thi | 73 |
| không | khong | 71 |
| người | ngwoi | 71 |
mà came out wrong on 28 of 30 pages. người, the word for "person", became ngwoi on 22.
The hook tone is vie's weak mark
Each tone, read right by vie:
| Tone | On a | vie right |
|---|---|---|
| Grave (huyền) | à | 96.3% |
| Acute (sắc) | á | 91.3% |
| Hook (hỏi) | ả | 69.0% |
| Tilde (ngã) | ã | 88.0% |
| Dot below (nặng) | ạ | 95.8% |
On these old prints the hook is small. vie read it as a grave 117 times, and để as đề 29 times. Check the hook first when you proofread.
Install vie, then pass -l vie
-
Debian or Ubuntu:
sudo apt install tesseract-ocr-vie -
macOS:
brew install tesseract-lang, all languages - Check:
tesseract --list-langsshows vie
This writes page.txt:
tesseract page.png page -l vie
In Python:
import pytesseract
print(pytesseract.image_to_string("page.png", lang="vie"))
Bigger models gain little, mixes lose marks
Each against plain vie, which took 1.8 seconds a page:
| Setting | Marks right | Sec a page |
|---|---|---|
| vie from tessdata_best | 94.1% | 3.6 |
-l vie+eng |
84.9% | 2.9 |
-l eng+vie |
84.9% | 2.8 |
| script/Vietnamese | 93.5% | 2.4 |
| script/Latin, for all Latin-alphabet languages | 29.4% | 2.4 |
Adding eng cost 1,392 or 1,403 marks, in either order. Words right fell from 85.3% to 80.1%.
script/Latin has no ơ or ư, so it is no fallback for Vietnamese.
How I tested it
- Pages: vi.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.
- Government gazettes were left out. They are typeset PDFs, not scans.
- 30 pages, 39,717 letters, 15,968 marks.
- Each scan is the wiki's page image: 26 at 1,920 px, 2 at 1,280 px, 2 at 960 px.
- Marks right: each tone and each ă, â, ê, ô, ơ, ư and đ read right, in order. A tone counts wherever the print puts it, so hoà and hòa score the same.
- Words right: syllables read right, marks and all, in order. Running heads and page numbers are not in the proofread text, so extra text costs 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 Vietnamese option
Our Apify Actor reads scans with Tesseract too, but its Language input has no Vietnamese. It starts at English. On these 30 scans, live build 0.1.44:
13.3% of marks right, left at English
19.6% of words right
No other language input read more than 20.0% of marks. For Vietnamese scans, use plain Tesseract with -l vie for now.
What I did not test
- Phone photos, faxes, and scans under 960 px wide.
- Pages in Han characters (chữ Hán, chữ Nôm). The check that the wiki text is the text on the scan left them out.
- Handwriting. See this test.
- Other languages. Thai, French and Italian 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 Vietnamese?
Yes, with the vie model. On 30 proofread book scans it read 93.6% of tone and vowel marks right. The default eng read 6.1%.
Why does Tesseract drop Vietnamese accents?
It runs with eng, the default, and eng has no ơ, ư or đ. On these scans eng read người as ngwoi 71 times. Pass -l vie.
Is vie from tessdata_best worth it?
A little. It read 94.1% of marks right, and it took 3.6 seconds a page, about twice as long as vie.