Sinhala OCR, tested with free Tesseract
96.2%
of Sinhala letters found by the sin model
Use sin, not script/Sinhala
288 pages I drew from Sinhala Wikipedia text. Not real scans.
| Model | Letters | Words |
|---|---|---|
| sin | 96.2% | 87.2% |
| sin best | 96.2% | 87.4% |
| script/Sinhala | 95.2% | 84.5% |
| script/Sinhala best | 95.1% | 83.8% |
| sin+eng | 94.8% | 86.4% |
sin is the fast model, the one in Homebrew's tesseract-lang. sin best tied on letters, with 0.2 points more words. sin from the older tessdata repo gave the same text on all 288 pages.
sin+eng wrote 953 Latin letters on pages that have none.
Phone photos cost the most
| Page | Letters | Words |
|---|---|---|
| Clean, 300 dpi | 97.4% | 86.6% |
| Half size, 150 dpi | 98.3% | 90.9% |
| Noisy scan | 98.3% | 90.6% |
| Phone photo | 90.7% | 80.7% |
On 9 of 72 photos, it lost lines or read them out of order. On one, it found nothing. Tesseract's Sauvola thresholding helped little: 91.1%.
One Mac font: ව reads as ච
| Font | Letters | Words |
|---|---|---|
| Noto Sans Sinhala | 97.0% | 93.9% |
| Noto Serif Sinhala | 97.6% | 94.7% |
| Sinhala Sangam MN | 93.9% | 72.9% |
215 of 464 ව read right, Sangam MN
464 of 464 ව read right, Noto Sans
On clean pages. Sinhala Sangam MN comes with macOS.
- Wikipedia text
- කාන්තාවන්ට එරෙහි ප්රචණ්ඩත්වය
- Tesseract sin, Sinhala Sangam MN
- කාන්තාචන්ට එරෙහි ප්රචණ්ඩත්චය
Joined letters mostly survive
Yansaya, rakaransaya (as in ශ්රී) and repaya are typed with an invisible joiner, U+200D. Without it, the word is spelled differently and an exact search misses it.
84.3% of words with a joiner right, sin
72.3% right, script/Sinhala
The script model wrote 1,604 joiners where the 288 pages have 1,932.
sin also adds an invisible U+200C after many al-lakunas (්) at the end of a word. A search still finds the word. To delete them:
perl -CSD -pe 's/\x{200C}//g' page.txt > clean.txt
Run it in 3 commands
On a Mac with Homebrew. The curl line puts sin in Homebrew's model folder:
brew install tesseract ocrmypdf
curl -L -o "$(brew --prefix)/share/tessdata/sin.traineddata" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/sin.traineddata
tesseract page.png page -l sin
That writes page.txt. After brew upgrade tesseract, run
the curl line again. Homebrew's tesseract-lang package has the same
file, with all the other languages.
Sinhala PDF to Word: OCR it
Copying from a typed Sinhala PDF breaks words. I printed the test paragraphs to PDF from Chromium, in Noto Sans Sinhala, then read the text back:
| Way | Letters | Words |
|---|---|---|
| Copy (pdftotext) | 100.0% | 65.5% |
| Copy (Preview) | 84.0% | 27.4% |
| OCRmyPDF, sin | 99.5% | 97.0% |
pdftotext kept every letter but put spaces inside words: සංගී තමය. Preview also moved vowel signs out of place. OCR the page instead:
ocrmypdf -l sin --force-ocr --sidecar out.txt typed.pdf out.pdf
Then paste out.txt into Word. For a scanned PDF, leave out
--force-ocr. On my 24 noisy scan pages, out.txt held
96.3% of the words.
Do not copy from out.pdf: pdftotext got 66.5% of its words whole.
Our Actor reads Sinhala
Our pdf-ocr Actor on the Apify Store reads Sinhala: set Language to Sinhala. On a PDF of 24 pages I drew with a scan look, it got 96.6% of words whole and right. English words on a Sinhala page come out wrong.
- Pages with their own text are free. A scanned page costs $0.006, and each run has a $0.00005 start fee at the default 1 GB.
- In a Sinhala run, a typed Sinhala page is read by OCR and costs $0.006 too, because its own text splits words.
How I tested it
- Text: one paragraph from each of 24 random Sinhala Wikipedia articles, 8,272 Sinhala letters, no Latin letters. Sinhala has no Wikisource of its own, and I found no proofread Sinhala scans to use.
- Drawn with Pillow and libraqm at 50 px, 12 pt at 300 dpi, in Noto Sans Sinhala, Noto Serif Sinhala and Sinhala Sangam 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, default page mode, one thread a page. Score: Sinhala letters in order, and whole words with their joiners.
- The commands above gave the same text as my test, on a copy of Homebrew's model folder. OCRmyPDF 17.13.0. Preview means PDFKit, the PDF engine of macOS 26.6.
What I did not test
- Real scans, old print and handwriting.
- PDFs typed in older non-Unicode Sinhala fonts.
- Google Lens, paid OCR and AI models.
- Apple Live Text: Apple's Vision text reader lists 30 languages on macOS 26.6, and Sinhala is not one of them.
Sources
Questions people ask
What is the best free OCR for Sinhala?
On our 288 test pages, Tesseract's fast sin model: 96.2% of Sinhala letters and 87.2% of whole words. sin best tied it, and the script models scored lower.
How do I convert a Sinhala PDF to Word?
OCR it with OCRmyPDF, -l sin and --sidecar, then paste the text file into Word. Copying from a typed PDF kept 65.5% of words whole. OCR kept 97.0%.
Does Apple Live Text read Sinhala?
Not on our Mac. Apple's Vision text reader lists 30 languages on macOS 26.6, and Sinhala is not one of them.
Related guides
- Amharic OCR, tested: free Tesseract models, and Amharic PDF to Word
- Tamil OCR, tested: free Tesseract models on 30 scans
- Telugu OCR, tested: free Tesseract models on 29 scans
- Scanned PDF to Word, free: 5 ways tested on a Mac
- OCRmyPDF language: -l codes, install, tested
- tessdata_best vs tessdata_fast, tested on real scans
- Nepali OCR, tested: free Tesseract models, and Preeti to Unicode