Tamil OCR: the best of five free Tesseract models
98.2%
of letters, with Tesseract's script/Tamil best
Five free models, under a point apart
We ran Tesseract 5.5.4 on 30 proofread pages from 10 printed books on ta.wikisource.
| Model | Letters | Words |
|---|---|---|
| script/Tamil best | 98.2% | 84.3% |
| script/Tamil | 97.9% | 83.6% |
| tam best | 97.8% | 83.5% |
| tam, tessdata repo | 97.8% | 83.5% |
| tam | 97.6% | 82.3% |
| tam+eng | 96.5% | 81.8% |
script/Tamil best came first on 4 of 10 books and tied on 1 more.
It is slower: 4.0 s a page, against 1.8 s for tam.
Letters are proofread letters found in order. Words are whole words right, with U+200C (below) taken as a space.
The command: one model, one cleanup
curl -LO https://raw.githubusercontent.com/tesseract-ocr/tessdata_best/4.1.0/script/Tamil.traineddata
mkdir -p tessdata && mv Tamil.traineddata tessdata/
tesseract page.png page --tessdata-dir tessdata -l Tamil
perl -CSD -pi -e 's/\x{200C}//g' page.txt
It writes page.txt. The last line deletes a character you cannot see.
Homebrew's brew install tesseract-lang has the fast
tam. Use -l tam (97.6% here).
The trap you cannot see
Every model wrote U+200C, the zero width non-joiner, right after the pulli (்). The proofread text has none.
tam best wrote it 2,693 times on our 30 pages.
A whole-word search sees it. In tam best's raw text, 41.0% of words matched whole. With U+200C deleted, 83.5% did.
Tesseract's blacklist option (-c tessedit_char_blacklist) did not remove it. On a test page the text came out the same, byte
for byte.
A scanned PDF: OCRmyPDF
cp -r "$(brew --prefix)/share/tessdata/configs" tessdata/
TESSDATA_PREFIX=$PWD/tessdata ocrmypdf -l Tamil --jobs 2 \
--sidecar book.txt scan.pdf book.pdf
perl -CSD -pi -e 's/\x{200C}//g' book.txt
On a 30-page PDF of the same scans it found 97.9% of letters in 105 s. It wrote book.txt and a searchable PDF/A.
The PDF's own text layer keeps U+200C. The perl line cleans book.txt only.
The first line is for Homebrew. On Linux, copy configs/ from your own tessdata folder.
Skip it and OCRmyPDF stops with
TesseractConfigError. Tesseract looks for its
configs/hocr file next to the model.
English words in a Tamil book
- tam has no Latin letters. Our pages hold 21 words in Latin letters, and tam, tam best and the tessdata repo's tam kept none of them.
- script/Tamil best kept 19 of 21. It reads Latin too, so it needs no +eng.
- tam+eng kept 16. On 24 pages with no English it wrote 271 stray Latin letters.
| Printed | முதல் தேர்வு (Preliminary) எழுதியிருந்தார். |
| script/Tamil best | மூதல் தேர்வு (Preliminary) எமுதியிருந்தார். |
| tam best | முதல் தேர்வு விவா? எழுதியிருந்தார். |
| tam | முதல் தேர்வு (மாகு) எழுதியிருந்தார். |
| tam+eng | முதல் தேர்வு (Preliminary) எழுதியிருந்தார். |
Apple Vision on macOS 26.6 lists 30 languages. Tamil is not one of them.
How we ran it
- Pages marked proofread or validated on ta.wikisource, from a seeded shuffle of books, 3 a book. Pages with footnotes, tables or running heads in the text were left out.
- 27 pages came from PDFs, 3 from a DjVu file, 984 to 1,920 px wide.
- Scores count Tamil letters and signs only. Digits, punctuation and Latin letters are left out.
- Models from tessdata_fast, tessdata_best and tessdata at tag 4.1.0. The tessdata repo's tam is a different file (3.4 MB), so we ran it too.
-
Turning the word list off (
-c load_system_dawg=0 -c load_freq_dawg=0) changed nothing for tam best, byte for byte, on all 30 pages. On Tesseract 5 these flags do nothing (our dictionary test). - One thread a page, 2 pages at a time, at low priority, while other jobs ran. Times are rough.
- OCRmyPDF 17.13.0. The PDF holds the 30 scans as JPEGs, one a page.
- Licenses: Tesseract and tessdata are Apache-2.0, OCRmyPDF is MPL-2.0. All 10 scan files are on Commons: 5 marked CC0, 5 public domain. We show no page images.
Scanned pages to text, no install
Run it yourself. Our Apify Actor turns a scanned PDF into Markdown or text. $0.006 a scanned page. It reads 18 languages, not Tamil yet.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free. For Tamil, ask first.
Questions people ask
Does Tesseract support Tamil?
Yes, with tam or the script/Tamil model. On our 30 pages, script/Tamil from tessdata_best read 98.2% of letters, the fast tam 97.6%.
Why does a search miss words in my Tamil OCR text?
Tesseract writes an invisible U+200C after the pulli. Delete it with perl -CSD -pi -e 's/\x{200C}//g' page.txt. On our pages, whole words found with tam best went from 41.0% to 83.5%.
Is there a free Tamil OCR?
Tesseract and its models are free (Apache-2.0) and run offline. OCRmyPDF (MPL-2.0) adds a text layer to a scanned PDF.
Can I OCR a Tamil PDF?
Yes. OCRmyPDF with -l Tamil and the script/Tamil best model found 97.9% of letters on our 30-page PDF and wrote a searchable PDF/A.
Should I use tam+eng?
Only if you keep tam and the page has English. script/Tamil best reads English on its own: it kept 19 of our 21 words in Latin letters, tam+eng 16.