Gujarati OCR: seven free Tesseract runs, tested
94.7%
of letters, with guj and one flag
One flag beats every model swap
We ran Tesseract 5.5.4 on 30 proofread pages from 10 printed books on gu.wikisource.
| Run | Letters | Words |
|---|---|---|
| guj, Sauvola threshold | 94.7% | 81.6% |
| guj | 87.2% | 74.7% |
| script/Gujarati best | 87.2% | 74.5% |
| guj, tessdata repo | 87.0% | 75.4% |
| guj best | 86.9% | 75.3% |
| script/Gujarati | 86.5% | 74.5% |
| guj+eng | 81.4% | 72.8% |
With the default threshold, the six other runs all wrote nothing on the same 2 pages. The Sauvola run read them.
Without those 2 pages, guj read 93.7% and guj with Sauvola 94.5%.
The tessdata repo's guj is a different network from the fast guj, not a copy.
Letters are proofread letters found in order. Words are whole words right.
The command: one model, one flag
curl -LO https://raw.githubusercontent.com/tesseract-ocr/tessdata_fast/4.1.0/guj.traineddata
mkdir -p tessdata && mv guj.traineddata tessdata/
tesseract page.png page --tessdata-dir tessdata -l guj \
-c thresholding_method=2
It writes page.txt. The model file is 1.4 MB.
thresholding_method=2 picks Sauvola, which sets the black
and white cut for each small area. The default, Otsu, sets one cut for
the whole page.
With the flag, guj took a median 2.6 s a page. Without it, 2.5 s.
Homebrew's brew install tesseract-lang has this same
fast guj. Then you can leave off --tessdata-dir.
Photographed pages gain the most
Two books came as photos of each page. The flag lifted them most.
| Printed | Default | Sauvola |
|---|---|---|
| 1921 | 90.3% | 90.4% |
| 1927 | 99.4% | 99.5% |
| 1928 | 89.4% | 88.7% |
| 1934 | 99.7% | 99.7% |
| 1940 | 88.1% | 88.5% |
| 1948, photos | 33.0% | 97.1% |
| 1952 | 93.6% | 93.4% |
| No year given, photos | 90.0% | 96.2% |
| No year given | 89.9% | 90.2% |
| No year given | 99.1% | 98.8% |
On 2 of the 1948 book's 3 pages, the default threshold made the gray paper and its text the same white. Tesseract saw an empty page.
On the other eight books, the flag moved the score 0.7 points or less. Page by page, it read more on 15 pages and fewer on 8.
The top slip: a lost anusvara
We lined up each page's letters with the proofread text and counted one-letter slips.
| Printed | Read as | Times |
|---|---|---|
| ં anusvara | Nothing | 167 |
| ો vowel sign o | ે vowel sign e | 68 |
| ન | ત | 49 |
| બ | ખ | 27 |
| ્ virama | Nothing | 22 |
guj best makes the same five slips, 23 to 165 times each. The bigger model trades slips: fewer ો read as ે, more ન read as ત.
A scanned PDF: use the same flag
mkdir -p tessdata
cp -r "$(brew --prefix)/share/tessdata/configs" tessdata/
curl -L -o tessdata/guj.traineddata \
https://raw.githubusercontent.com/tesseract-ocr/tessdata_fast/4.1.0/guj.traineddata
TESSDATA_PREFIX=$PWD/tessdata ocrmypdf -l guj --jobs 2 \
--tesseract-thresholding sauvola \
--sidecar book.txt scan.pdf book.pdf
On a 30-page PDF of the same scans it took 82 s.
book.txt held 94.5% of letters, 87.6% without the flag.
| From | Letters in order | Words |
|---|---|---|
| book.txt | 94.5% | 81.9% |
| book.pdf, pdftotext | 93.4% | 76.8% |
| book.pdf, pdftotext -raw | 94.5% | 76.9% |
| book.pdf, PDFKit (macOS) | 93.8% | 80.6% |
PDFKit, the Mac framework behind Preview, lost 126 of the 435 િ signs in book.txt. Search book.txt.
Without the cp line (Homebrew), OCRmyPDF stops with
TesseractConfigError.
Three more things we checked
- guj+eng wrote 1,109 Latin letters on 23 pages that have none. Leave off +eng: guj and guj best wrote none.
- No Gujarati model here can write ઐ or the nukta ઼. Our 30 pages hold one of each.
- Apple Vision on macOS 26.6 lists 30 languages, not Gujarati.
How we ran it
- Pages marked proofread or validated on gu.wikisource, from a seeded shuffle of books, 3 a book. Pages with footnotes, tables or running heads in the text were left out.
- All 30 pages came from PDFs, drawn at most 1,920 px wide.
- Scores count Gujarati letters and signs. Digits, punctuation, Latin letters and spaces are left out.
- Letters found in order is the longest common subsequence. Slips come from a second alignment, so counts are close, not exact.
- Models from tessdata_fast, tessdata_best and tessdata at tag 4.1.0.
- One thread a run, 2 runs at a time, at low priority, while other jobs ran. Times are rough.
- OCRmyPDF 17.13.0, pdftotext from Poppler 26.03.0, PDFKit on macOS 26.6. 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: 7 public domain, 3 CC BY-SA 4.0. 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 Gujarati.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free. For Gujarati, ask first.
Questions people ask
Does Tesseract support Gujarati?
Yes, with guj or script/Gujarati. On our 30 pages, guj read 87.2% of letters, and 94.7% with -c thresholding_method=2.
Which Tesseract model is best for Gujarati?
The five Gujarati models sit within 0.7 points: 86.5% to 87.2% of letters. The threshold matters more than the model.
Why does Tesseract return a blank page?
Its default threshold can turn gray paper and its text the same white. With -c thresholding_method=2 (Sauvola), our 2 blank pages read 98.6% and 95.4%.
Can I OCR a Gujarati PDF?
Yes. OCRmyPDF with -l guj and --tesseract-thresholding sauvola found 94.5% of letters on our 30-page PDF. Without the flag it found 87.6%.
Should I add English, as guj+eng?
Only if you need the English words. guj+eng read 81.4% of letters, guj 87.2%, and guj+eng wrote 1,109 Latin letters on 23 pages that have none.