Khmer and Myanmar OCR, tested with free Tesseract
96.8%
of Khmer letters read right, khm --psm 4
Add --psm 4 to every run
576 pages I drew from Khmer and Burmese Wikipedia text, 288 of each.
| Model | Letters | Words |
|---|---|---|
| khm | 91.4% | 82.7% |
| khm --psm 4 | 96.8% | 88.0% |
| khm best --psm 4 | 96.9% | 88.1% |
| mya | 62.7% | 50.6% |
| mya --psm 4 | 83.6% | 66.7% |
| mya best --psm 4 | 84.0% | 67.0% |
Neither script puts spaces between words, so I split words the way Chrome does. The larger best models were only 0.1 to 0.4 points better.
The default mode skips lines
14 to 1 Khmer pages of 288 half read or worse, without and with --psm 4
109 to 20 Burmese pages of 288, the same way
On clean pages and photos, the default mode often found only some of the lines, or none. --psm 4 reads the page as one column of lines. On blurred, noisy pages, both modes scored about the same.
mya cannot write ။ or ၏
Six common Burmese marks are not in mya's list of characters: ။ ၊ ၏ ၍ ၌ ၎. So it never writes them. It wrote marks like ; and ! instead.
It also swapped letters that look alike, most often က as တ and ပ as ဝ:
- Wikipedia text
- နည်းပညာ
- Tesseract mya
- နည်းဝညာ
With --psm 4 it also wrote almost twice as many spaces as the text has, and about 1 line in 4 held no word, only loose letters.
For Burmese, the font matters
| Font | Khmer | Burmese |
|---|---|---|
| Noto Sans | 97.6% | 96.3% |
| Noto Serif | 97.0% | 75.5% |
| Khmer Sangam MN, Padauk | 95.8% | 78.9% |
Khmer held up in all 3 fonts. Its most common swap: the vowel ៃ as ែ, so នៃ (of) came out as នែ.
Real scans: about 70%
Wikisource has proofread scans of both: 12 Burmese pages from 4 public domain scans, and 9 Khmer pages.
| Scan | Letters |
|---|---|
| Khmer magazine, 1926, slanted type | 58.2% |
| Khmer Land Law, 2001 | 90.5% |
| ရွှေဘုံနိဒါန်း | 81.1% |
| နန္ဒီသေနပျို့ | 55.2% |
| UN Charter in Burmese | 72.0% |
| ရွှေမန်းတင်မောင် | 87.0% |
All told: 69.7% of Khmer letters and 71.8% of Burmese. One person proofread these pages, and no second person checked them. The 1926 magazine's slanted type read worst.
Run it in 3 commands
On a Mac with Homebrew:
brew install tesseract ocrmypdf
curl -fL -o "$(brew --prefix)/share/tessdata/khm.traineddata" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/khm.traineddata
tesseract page.png page -l khm --psm 4
For Burmese, write mya where it says khm. After
brew upgrade tesseract, run the curl line again.
On Debian 12 or Ubuntu 24.04 and later:
sudo apt install tesseract-ocr-khm tesseract-ocr-mya
Khmer PDF to text: use pdftotext
I printed the passages to PDF in Noto Sans and read the text back:
| Way | Khmer | Burmese |
|---|---|---|
| Copy (pdftotext) | 93.3% | 99.1% |
| Copy (Preview) | 31.1% | 49.1% |
| OCRmyPDF, --psm 4 | 87.8% | 86.1% |
pdftotext kept every letter in both scripts. Preview kept 72.3% of the Khmer letters. For a scanned PDF:
ocrmypdf -l khm --tesseract-pagesegmode 4 --sidecar out.txt scan.pdf out.pdf
Then use out.txt. On 24 noisy scan pages in Noto Sans, it held 98.2% of the Khmer letters. Text copied from out.pdf came out worse.
Our Actor reads Khmer and Burmese
Set Language to Khmer or Burmese in our pdf-ocr Actor on the Apify Store. On 24 pages a script, drawn in Noto Sans with a scan look, it got 90.1% of Khmer words whole and right, and 97.1% of Burmese.
- Pages with their own text: free. Scanned pages: $0.006 each, plus a $0.00005 start fee a run at the default 1 GB.
- With Khmer set, typed Khmer pages go to OCR and cost $0.006 too: their own text drops letters.
- Burmese reads much worse in other fonts, and two-column pages can lose lines.
- On Apify's free plan, it stops at 20 pages a run and 50 a month.
How I tested it
- Text: whole sentences from 24 random Khmer and 24 random Burmese Wikipedia articles, 8,272 and 7,937 letters, no Latin letters. I took out zero-width spaces, which Khmer Wikipedia uses between words.
- Drawn with Pillow and libraqm at 50 px, 12 pt at 300 dpi, with line breaks only between words. Khmer: Noto Sans Khmer, Noto Serif Khmer, Khmer Sangam MN (macOS). Burmese: Noto Sans Myanmar, Noto Serif Myanmar, Padauk.
- Padauk, not a macOS font: Pillow could not draw 2 vowel and tone mark pairs (ူ့, ုံ့) in Myanmar Sangam MN or Myanmar MN.
- Page types: clean; half size; blur, noise and hard JPEG; a phone photo with tilt, uneven light and JPEG. Same code as my OCR font test.
- Tesseract 5.5.4, models from the 4.1.0 tag, one thread a page. Score: letters and signs in order. Extra letters a model writes do not lower its score. Words: Chrome's word split (ICU) on both sides, whole words only.
- Real scans: proofread Wikisource pages, text as the wiki shows it, the scan as Wikimedia serves it. I left out 3 Khmer pages with under 300 letters. No Khmer or Burmese page there is marked validated.
- OCRmyPDF 17.13.0, pdftotext 26.03.0. Preview means PDFKit, the PDF engine of macOS 26.6.
What I did not test
- Handwriting, two-column pages (--psm 4 can mix the columns), and Burmese typed in a Zawgyi font.
- Google Drive and Lens, paid OCR and AI models. Surya lists both languages, but its model license limits commercial use.
- Khmer-only tools such as KhmerOCR (MIT) and kiri-ocr (Apache-2.0).
- A third-party mya model, pndaza/tesseract-myanmar: it has no license file.
- EasyOCR, PaddleOCR and Apple's Vision reader (Live Text): none of them lists Khmer or Burmese.
Sources
- Tesseract's fast models on GitHub (Apache-2.0)
- tessdata issue 178: a request for a new mya model
- tesseract issue 2232: Burmese marks left out of training text
- Noto Khmer and Noto Myanmar (OFL 1.1), Padauk (OFL 1.1)
- Sample articles: Burmese and Khmer, text under CC BY-SA 4.0, drawn as images by me
- Burmese Wikisource and the 1926 Khmer magazine on Wikisource
- OCRmyPDF on GitHub
Questions people ask
What is the best free OCR for Khmer?
Of the free tools we ran, Tesseract's khm with --psm 4, on our 288 test pages: 96.8% of Khmer letters and 88.0% of words. On 9 real proofread scan pages it read 69.7% of letters.
What is the best free OCR for Myanmar (Burmese)?
Of the free tools we ran, Tesseract's mya with --psm 4: 83.6% of Burmese letters on our 288 test pages, 71.8% on 12 real scan pages. It cannot write ။ ၊ ၏ ၍ ၌ or ၎, so check its text by eye.
How do I convert a Khmer PDF to text?
If the PDF has its own text, copy it with pdftotext: every letter, and 93.3% of words whole. Preview kept 31.1% of words. For a scanned PDF, run OCRmyPDF with -l khm, --tesseract-pagesegmode 4 and --sidecar.