Tools,

Tibetan OCR: Tesseract on books and pecha, tested

94.3%

of letters on typeset book pages, with bod

Get the command

Book pages read well, pecha pages do not

We ran Tesseract 5.5.4 on 38 proofread Tibetan pages from wikisource.org.

Letters found, by run
Run Book pages (11) Pecha (27)
bod 94.3% 20.2%
bod best 94.3% 20.9%
bod, --psm 6 91.0% 45.5%
bod best, --psm 6 90.9% 48.9%
bod best, --psm 6, Sauvola 92.9% 46.6%
script/Tibetan best, --psm 6 88.9% 44.6%
script/Tibetan, --psm 6 89.0% 41.6%
dzo, --psm 6 81.8% 34.4%

The book pages come from 4 typeset books. The pecha pages come from 10 woodblock texts.

Letters are proofread letters found in order. Whole syllables right, best runs: 89.4% on book pages, 24.5% on pecha (Sauvola).

Book pages: the default command

brew install tesseract tesseract-lang
tesseract page.png page -l bod

It writes page.txt. Homebrew's tesseract-lang installs the fast bod, a 2.0 MB file.

bod best tied it at 94.3% and took longer: a median 2.9 s a page, against 2.4 s.

Leave the page mode alone here. --psm 6 cost 3.3 points on book pages.

Pecha: add --psm 6 or lose pages

curl -LO https://raw.githubusercontent.com/tesseract-ocr/tessdata_best/4.1.0/bod.traineddata
mkdir -p tessdata && mv bod.traineddata tessdata/
tesseract pecha.png pecha --tessdata-dir tessdata -l bod --psm 6

In the default page mode, Tesseract wrote nothing on 10 of 27 pecha pages. On one, it printed:

Detected 788 diacritics
Empty page!!

--psm 6 reads the page as one block of text. With it, no page came out empty, and bod read more letters on 23 of 27 pages.

bod best is an 8.6 MB file. It took a median 5.1 s a pecha page.

Red ink: try the Sauvola threshold

Seven of the 27 pecha pages are printed in red ink.

bod best, --psm 6: letters found
Threshold Red ink Black ink
Default (Otsu) 46.5% 49.6%
Sauvola 50.5% 45.4%
tesseract pecha.png pecha --tessdata-dir tessdata -l bod --psm 6 \
  -c thresholding_method=2

Sauvola helped red ink and hurt black ink. Per text, bod best with --psm 6 read 40.8% to 61.2%.

The top slips: dropped vowels and ya

27 pecha pages: bod best with --psm 6, top slips
Printed Read as Times
◌ོ naro Nothing 106
◌ི gigu Nothing 78
◌ེ drengbu Nothing 69
◌ྱ subjoined ya Nothing 63
◌ི gigu ◌ེ drengbu 46

On book pages, the top slip of bod was ◌ི read as ◌ེ: 83 times.

A scanned PDF: the same split

ocrmypdf -l bod --sidecar book.txt scan.pdf book.pdf

For pecha, use bod best and the flag:

mkdir -p tessdata
cp -r "$(brew --prefix)/share/tessdata/configs" tessdata/
curl -L -o tessdata/bod.traineddata \
  https://raw.githubusercontent.com/tesseract-ocr/tessdata_best/4.1.0/bod.traineddata
TESSDATA_PREFIX=$PWD/tessdata ocrmypdf -l bod --jobs 2 \
  --tesseract-pagesegmode 6 \
  --sidecar pecha.txt scan.pdf pecha.pdf
Letters found in each PDF
PDF Sidecar text Text layer
Book pages, bod, default 93.9% 90.9%
Pecha, bod best, --tesseract-pagesegmode 6 47.6% 42.6%
Pecha, bod best, default 35.7% 30.5%

The text layer is what pdftotext reads back from the output PDF. Search the sidecar file.

Time: 25.2 s for the book PDF, 81.6 s for the pecha PDF.

Six more things we checked

How we ran it
  • bo.wikisource.org sends visitors to wikisource.org, which holds the Tibetan books. 778 of its 785 Tibetan books with 2 or more proofread pages have a wide first page, the pecha shape.
  • Pages marked proofread, from a seeded shuffle of books, 3 a book (2 for some). Pages with footnotes, tables or unknown templates were left out.
  • The 7 files with a book-shaped first page gave the 4 books of the book set.
  • Of the other 3, one has no scans, one is over 80 MB, and one holds pecha pages.
  • Pecha pages were drawn 3,000 px wide. Book pages were drawn at their scan width, 1,123 to 3,008 px.
  • Scores count Tibetan letters, subjoined letters, vowel signs and marks. The tsheg, shad, digits, spaces and Latin letters are left out. A syllable is the letters between two tshegs or shads.
  • 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. The PDFs hold the scans as JPEGs, one a page.
  • Licenses: Tesseract and tessdata are Apache-2.0, OCRmyPDF is MPL-2.0. All 14 scan files are on Commons, marked public domain. We show no page images and quote no passage.

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 Tibetan.

Try the Actor

Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free. For Tibetan, ask first.

Get one page free

Questions people ask

Does Tesseract support Tibetan?

Yes, with bod, script/Tibetan or dzo. On our 11 typeset book pages, bod read 94.3% of letters with no flags.

Why does Tesseract return an empty page?

On woodblock pecha, the default page mode wrote nothing on 10 of 27 pages. Add --psm 6.

Which Tesseract model is best for Tibetan?

On book pages, bod and bod best tie at 94.3%. On pecha, bod best with --psm 6 read the most letters, 48.9%.

Can I OCR a Tibetan PDF?

Yes. OCRmyPDF with -l bod found 93.9% of letters on our book pages. For pecha, use bod best and add --tesseract-pagesegmode 6 (47.6% of letters).

Is Tesseract good enough for pecha?

Not for a clean text. On our 27 pecha pages, the best run got 48.9% of letters and 20.1% of whole syllables right. We did not test other OCR tools.