Tesseract Chinese OCR: which model reads your scans
88%
characters right with chi_sim on simplified scans
Simplified Chinese scans: $0.006 a page
chi_tra writes 车 as 車
One line from a 1975 document. Bold characters are wrong:
| Model | Read |
|---|---|
| Proofread |
纱、棉布、自行车,完成了全年计划的百分之四十五以上。
|
| chi_sim |
纱\棉布自行车,完成了全年计划的百分之四十五以上。
|
| chi_tra |
紗、棉布、自行車,
完成了全年計劃的百分之四十五以上。
|
| chi_sim_vert |
请 ”天 当 。 辐 古 “ 淹 证 只 省 中间 奸 到 沁 作 国 十 册 屎
二 。
|
| eng | DMA ATE, CRISFTMHAALOTEULE. |
Each model is made for one script and one direction. chi_sim missed two of the small commas, which this test does not count.
Simplified scans: fast ties best
Proofread scans from 10 books, 1958 to 2019, in lines across the page. Characters right, of 14,585:
| Model | Size | Right |
|---|---|---|
| eng | 4.1 MB | 0.0% |
| chi_sim_vert | 1.9 MB | 1.6% |
| chi_tra | 2.4 MB | 62.2% |
| chi_sim, tessdata | 44.4 MB | 77.6% |
| chi_sim, best | 13.1 MB | 87.9% |
| script/HanS | 6.0 MB | 88.3% |
| chi_sim, fast | 2.5 MB | 88.4% |
The fast file is the one apt and Homebrew install. best was no better, and took 3 times as long: 2.35 s a page against 0.77 s.
How I tested it
- Pages: zh.wikisource scans whose text was proofread (level 3) or also checked by a second person (level 4). Books printed in 1900 or later, one file per work, picked by a seeded shuffle, not by me.
- Each page is a real scan: a DjVu file, or a PDF page that holds one full-page image. Pages were 1920 px wide.
-
One plain
tesseractrun per page and model, default settings, Tesseract 5.5.4. - A character counts when it is found in order. Only Chinese characters count: Wikisource adds modern punctuation to many old books.
Vertical text needs a _vert model
Traditional Chinese in columns, from 10 books, 1910 to 1973. Characters right, of 10,865:
| Model | Size | Right |
|---|---|---|
| chi_sim | 2.5 MB | 1.5% |
| chi_tra | 2.4 MB | 2.0% |
| chi_sim_vert | 1.9 MB | 33.6% |
| script/HanT_vert | 5.4 MB | 47.3% |
| chi_tra_vert, fast | 1.8 MB | 48.6% |
| chi_tra_vert, best | 13.0 MB | 52.0% |
| chi_tra_vert, tessdata | 2.4 MB | 52.4% |
About half is the honest number for these old pages. The fast file lost the layout of one 1924 book: 1.8%, where best got 77.8%.
Why so low, and does --psm 5 help?
- Three books got under 31% with best: a 1944 report, a 1910 textbook, and a 1923 primer at 16.4%.
- The print uses old variant forms such as 爲. chi_tra_vert has no 爲 and writes 為, which counts as wrong. Such forms are 1.3% of these characters.
-
--psm 5, one block of vertical text, took the fast file from 48.6% to 51.5%.
Spaces between characters
The best file puts a space between Chinese characters. One flag removes them:
8,965 spaces with chi_sim best
38 with
-c preserve_interword_spaces=1
Not one character changed. The fast chi_sim adds almost none, but the fast vertical files do, and the same flag removes most of them.
Install the model and run it
apt (tesseract-ocr-chi-sim) and Homebrew (tesseract-lang) install the fast files. To pick your own, put them in a folder:
mkdir -p ~/tessdata
curl -L -o ~/tessdata/chi_sim.traineddata \
https://raw.githubusercontent.com/tesseract-ocr/tessdata_fast/4.1.0/chi_sim.traineddata
curl -L -o ~/tessdata/chi_tra_vert.traineddata \
https://raw.githubusercontent.com/tesseract-ocr/tessdata_best/4.1.0/chi_tra_vert.traineddata
tesseract page.png page --tessdata-dir ~/tessdata -l chi_sim
In Python, with pytesseract. For columns, use chi_tra_vert:
import os
import pytesseract
TESSDATA = os.path.expanduser("~/tessdata")
text = pytesseract.image_to_string(
"page.png",
lang="chi_sim",
config=f"--tessdata-dir {TESSDATA} -c preserve_interword_spaces=1",
)
What I did not test
- Windows and Linux. One Mac, Tesseract 5.5.4.
- Woodblock prints, manuscripts and handwriting.
- Simplified text in columns, and Japanese.
- English mixed in, such as
-l chi_sim+eng. - Cleaning the image first, and other OCR engines.
Sources
Our Actor reads simplified Chinese
Our Apify Actor has the same fast chi_sim. On the simplified scans it got 86.5% of the characters right. It has no vertical model: on the column scans it got 1.7%.
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
Which Tesseract model reads simplified Chinese?
chi_sim. On 36 proofread scans the small fast file got 88.4% of the characters right, and the large best file got 87.9% in 3 times the time.
How do I OCR vertical Chinese with Tesseract?
Use a _vert model, such as chi_tra_vert for traditional text. On 36 column scans, chi_tra_vert best got 52.0% of the characters right and chi_tra got 2.0%.
Why does Tesseract put spaces between Chinese characters?
Most model files add them, but the fast chi_sim does not. Add -c preserve_interword_spaces=1. With chi_sim best, the spaces went from 8,965 to 38, and no character changed.