Tesseract Hindi OCR: which model reads your scans
91%
letters right with the fast hin
Without -l hin, nothing
Tesseract reads English unless you name the language:
0.0% letters right with the default eng
91.0% with -l hin
eng has no Devanagari letters, so not one came out right.
The small fast file beats best
Proofread scans from 24 books, printed 1888 to 2012. Letters right, of 116,316:
| Model | Size | Right |
|---|---|---|
| hin+eng | 5.2 MB | 84.3% |
| script/Devanagari, fast | 17.9 MB | 88.7% |
| script/Devanagari, best | 28.6 MB | 89.3% |
| hin, best | 11.9 MB | 90.2% |
| hin, fast | 1.1 MB | 91.0% |
18 of 24 books where fast beat best
1.6x slower a page with best
The hardest book, a 1997 print with faint, broken type, got 69.3% with the fast hin.
How I tested it
- Pages: hi.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, one file per work. Two books have no year.
- Each page is a real scan: a DjVu file, or a PDF page that holds a full-page image. Pages were drawn from the file at the scan's own width, up to 1920 px. The wiki's thumbnails were smaller, so I did not use them.
-
One plain
tesseractrun per page and model, default settings, Tesseract 5.5.4. - A letter counts when it is found in order. Only Devanagari letters and signs count, not digits or the danda (।).
-
The tessdata repo's hin read 90.3%. Its old engine (
--oem 0) does not load: the file has no part for it. -
Sauvola thresholding (
-c thresholding_method=2) changed little: 91.1% with the fast hin.
Adding eng costs 6.7 points
One printed line from a 1933 history book:
| Model | Read |
|---|---|
| Proofread |
देश से निकाल दें। पटने में जो अंगरेज़ो सौदागर थे उनको
पकड़
|
| hin |
देश से निकाल दें। परने में जो अंगरेज़ो सौदागर थे उनको
पकड़
|
| hin+eng |
देश से निकाल दें। परने में at अंगरेज़ो सौदागर थे उनको
पकड़
|
24 of 24 books read less with hin+eng
7,285 Latin letters from hin+eng, 0 from hin
hin never writes the digit 1
A 2008 book prints the year 1739 twice:
| Reader | Read |
|---|---|
| Printed | 1739, 1739 |
| hin, fast | 739, 7739 |
| hin, best | 739, 739 |
| hin, 1 allowed | 1739, 1739 |
The hin file's own config blocks 1 (tessedit_char_blacklist 1). -c tessedit_char_blacklist= clears it.
0 ones from hin on 94 pages
73 with the block cleared
Clearing it lost 19 dandas (।). Do it only if your pages print 0 to 9.
Install the model and run it
apt (tesseract-ocr-hin) and Homebrew (tesseract-lang) install the fast file, the one that read the most. Without a package:
mkdir -p ~/tessdata
curl -L -o ~/tessdata/hin.traineddata \
https://raw.githubusercontent.com/tesseract-ocr/tessdata_fast/4.1.0/hin.traineddata
tesseract page.png page --tessdata-dir ~/tessdata -l hin
In Python, for pages that print 0 to 9:
import os
import pytesseract
TESSDATA = os.path.expanduser("~/tessdata")
text = pytesseract.image_to_string(
"page.png",
lang="hin",
config=f"--tessdata-dir {TESSDATA} -c tessedit_char_blacklist=",
)
What I did not test
- Windows and Linux. One Mac, Tesseract 5.5.4.
- Handwriting, manuscripts and pages with tables.
- Phone photos, screenshots and signs.
- Marathi, Sanskrit and Nepali pages.
- Office papers full of 0 to 9. Only one page here prints them.
- Other OCR engines.
Sources
Our Actor uses the same file
Our Apify Actor reads Hindi with this same fast hin, but got 85.4%: less than plain hin on 71 of 94 pages.
It joined the two columns of an encyclopedia line by line (49.4%). It also wrote 739 for both years.
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 is best for Hindi?
On 94 proofread scans, the fast hin got 91.0% of the letters right, hin best 90.2% and script/Devanagari best 89.3%. apt and Homebrew install the fast one.
Should I use hin+eng for Hindi pages?
Not for Hindi text. Adding eng cut the letters right from 91.0% to 84.3%, and it read less on all 24 books.
Why does Tesseract never read the digit 1 in Hindi?
The hin file blocks it in its own config. Add -c tessedit_char_blacklist= to allow 1, if your pages print 0 to 9.