Khmer-script Pāli and Khmer OCR
A Tesseract model that reads both leaves of each opening of the Buddhist Institute edition of the Tipiṭaka (Phnom Penh,
1927–69): the Pāli, and its Khmer translation, both printed in Khmer script, in that edition's typeface. Fine-tuned from Google's Tesseract Khmer model (khm, tessdata_best, Apache-2.0) — the reason this model is Apache-2.0.
The other model: siliconwat/khmer-pali-ocr-cc0 — trained from scratch, public domain (CC0). Both read the same print; choose by license and accuracy.
How well it reads
Measured 2026-11-20 on pages from four volumes this model never saw in training (Vinaya vol. 13, Majjhima vol. 25, Aṅguttara vol. 45, Abhidhamma vol. 83), against the transcriber's own typing of those pages, under rules written down before training:
| Pāli leaf (80 pages) | Khmer leaf (80 pages) | |
|---|---|---|
| characters wrong (median page) | 1.7% · compact version 1.7% | 1.2% · compact version 1.1% |
| words right (median page) | 90% | — ² |
| by volume (13 · 25 · 45 · 83) | 2.5% · 0.9% · 1.8% · 1.1% | 1.8% · 0.9% · 1.6% · 0.8% |
| known Cambodian readings turned into the Burmese (CST) form | 1 of 47 ¹ | — ³ |
Why the bias row matters. The Cambodian edition differs from the Burmese-line text most software knows (the Chaṭṭha Saṅgāyana, CST) in thousands of places. A general-purpose AI reader that knows Pāli tends to "correct" those readings toward the text it expects, silently erasing them. This model has learned only from the Cambodian print, and was tested for exactly that failure on readings the edition's own footnotes, or the CST's own notes, mark as Cambodian.
¹ This model has never seen the CST, so a reading in the CST's form is not a learned prior: the print may read that way on that page. Check it against the print. ² Khmer is written without spaces between words, so a "word" here would be a whole phrase between spaces and one wrong letter would spoil it; characters are the meaningful measure. ³ No outside source marks the edition's own Khmer spellings, so this test does not exist for the Khmer leaf.
How to use it
The model reads one printed line at a time (Tesseract's single-line mode). Cut the page into lines first (our line finder is a horizontal ink profile; on the Khmer leaf, where stacked vowels make lines touch, a band much taller than the rest is split at its thinnest row), then:
tesseract line.png - --tessdata-dir . -l khm-pali --psm 13 -c load_system_dawg=0 -c load_freq_dawg=0
khm-pali.traineddata— the full model;khm-pali-int.traineddata— the compact version (-l khm-pali-int), small enough for a web page (1.0 MB), measured as accurate as the full one.- In a browser: tesseract.js loads either file. ocr.siliconwat.dev runs it entirely in the browser, with no upload of your images, and reads a PDF, a scan or a photo.
Limits
- Trained on one edition's typeface; other printings are untested. Photos from a phone have not been measured.
- It learned from one person's typing, including a few of his habits (for example ត where the print has គ). Check what it produces against the print, as you would any transcription.
- Footnotes (smaller type) are under-represented in training; the Vinaya volumes are its weakest.
- Full-page reading without a separate line finder has not been measured.
Training
Tesseract 5.5.2 with tesstrain (405346a), Khmer normalization mode (Indic). 73,663 printed lines, each paired with
the transcriber's own typing of it:
- Pāli: 33,658 lines from 2,031 pages (15,953 from pages he typed line by line; 17,705 lined up by an alignment checked against his known line breaks: 98.5% exact).
- Khmer: 40,005 lines from 2,257 pages. On 372 pages a large language model read the page only to show where each printed line falls; the labels are always his own text. A first Khmer model trained on those then lined up the rest (on fresh pages its cuts were identical to the language model's on 276 of 276 lines).
- Four volumes and every test page were held out. The best checkpoint was chosen on held-back lines; the rules, the test pages and the predictions were committed before training.
⛔ The page images used in training are not released. The transcriber's typed text is published separately, credited to
the Buddhist Institute edition: siliconwat/khmer-tipitaka-transcription.
Credits
- Transcription: Se Mong Ly (លី ម៉ុង សែ), who typed the Tipiṭaka page by page: the Pāli, and its Khmer translation.
- Text: the Buddhist Institute edition of the Tipiṭaka (Phnom Penh, 1927–69).
- Scans: Upāsikā Kang Huychan and family · Lok Kru Aggapaṇḍita But Savong · Srong Chanda · 5000-years.org, given as dhamma dāna, a gift of the Dhamma.
- Model: Silicon Wat℠, prepared with Miss Aquarius℠ (AI collaboration, disclosed).
License
Apache License 2.0 (see LICENSE and NOTICE): a modified version of Google's Tesseract Khmer model.
Offered as a gift of the Dhamma. Sabbadānaṃ dhammadānaṃ jināti — the gift of the Dhamma surpasses every gift (Dhammapada 354).