Nepali OCR, tested with free Tesseract
97.7%
of Nepali words read right by the nep model
Use nep, not hin
288 pages I drew from Nepali Wikipedia text. Not real scans.
| Model | Letters | Words |
|---|---|---|
| nep | 98.4% | 97.7% |
| nep best | 98.1% | 96.2% |
| script/Devanagari | 98.3% | 97.2% |
| hin (Hindi) | 97.5% | 93.4% |
| nep+eng | 98.0% | 97.4% |
nep is the fast model, the one in Homebrew's tesseract-lang. The larger nep best did not beat it.
nep+eng wrote 230 Latin letters on pages that have none, and 94 | for the full stop ।.
The Hindi model writes no ङ
Nepali and Hindi share one script, so hin looks like an easy first try. But ङ, a nasal letter that Nepali uses often, is not in hin's list of letters.
0 ङ written by hin, where the 216 non-photo pages have 243
23 ञ written by hin, where they have 63
- Wikipedia text
- खरसाङ
- Tesseract hin
- खरसाड
nep wrote all 243.
Check the numbers: ५ can read as ४
Noto Sans and Noto Serif draw Nepali forms of ५ and ८ for text marked as Nepali, and Noto Serif also of ९. nep often misread ५ and ९:
| Font | Digits | Most common miss |
|---|---|---|
| Noto Sans Devanagari | 92.1% | ५ as ४, 32 of 42 |
| Noto Serif Devanagari | 82.4% | ९ as ५, 33 of 42 |
| Kohinoor Devanagari | 100.0% | none |
Kohinoor comes with macOS and draws the Hindi forms.
Phone photos cost the most
| Page | Letters | Words |
|---|---|---|
| Clean, 300 dpi | 99.6% | 98.1% |
| Half size, 150 dpi | 99.6% | 98.0% |
| Noisy scan | 99.7% | 98.6% |
| Phone photo | 94.7% | 96.0% |
On 1 of 72 photos, nep wrote nothing. On 6 more, it read the words but put the lines in the wrong order. So letters, counted in order, score lower there than words.
Run it in 3 commands
On a Mac with Homebrew. The curl line puts nep in Homebrew's model folder:
brew install tesseract ocrmypdf
curl -fL -o "$(brew --prefix)/share/tessdata/nep.traineddata" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/nep.traineddata
tesseract page.png page -l nep
After brew upgrade tesseract, run the curl line again.
Homebrew's tesseract-lang package has the same file, with all the
other languages.
On Debian or Ubuntu: sudo apt install tesseract-ocr-nep.
Nepali PDF to Word: copy with pdftotext
I printed the passages to PDF from Chromium, in Noto Sans Devanagari, and read the text back:
| Way | Letters | Words |
|---|---|---|
| Copy (pdftotext) | 100.0% | 96.1% |
| Copy (Preview) | 89.2% | 61.3% |
| OCRmyPDF, nep | 99.7% | 99.3% |
pdftotext kept every letter and digit, but split some words, like क्रिकेट as क्रिके ट. OCR read 13 of 148 digits wrong. Preview dropped every vowel sign ि: थियो became थयो.
For a scanned PDF:
ocrmypdf -l nep --sidecar out.txt scan.pdf out.pdf
Then paste out.txt into Word. On my 24 noisy scan pages, out.txt held 99.2% of the words.
Preeti to Unicode: convert the codes
Preeti is an old Nepali font that puts Nepali letters on English keys. So a Preeti PDF usually copies out as codes like g]kfn for नेपाल.
| Converter | Codes A | Codes B |
|---|---|---|
| nep-ttf2utf | 99.5% | 98.0% |
| legacy-fonts-to-unicode | 99.7%* | 98.1% |
| npttf2utf | 99.5% | 98.0%* |
Codes A came from legacy-fonts-to-unicode, codes B from npttf2utf. The two differ on all 24 passages. *: one tool both ways. To run nep-ttf2utf:
git clone https://github.com/sapradhan/nep-ttf2utf.git
cd nep-ttf2utf && python3 -m venv .venv && .venv/bin/pip install PyYAML
.venv/bin/python ttf2utf/main.py preeti.txt unicode.txt
No codes? Then the PDF is a scan: OCR it as above.
Our Actor reads Nepali
Our pdf-ocr Actor on the Apify Store reads Nepali: set Language to Nepali. On a PDF of 24 pages I drew with a scan look, it got 99.2% of words whole and right. A Preeti PDF keeps its codes, so convert them as above.
- 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 Nepali run, a typed Nepali page is read by OCR and costs $0.006 too, because its own text splits words.
How I tested it
- Text: whole sentences from 24 random Nepali Wikipedia articles, 7,446 letters, no Latin letters. I found no proofread Nepali scans on Wikisource.
- Drawn with Pillow and libraqm at 50 px, 12 pt at 300 dpi, marked as Nepali, in Noto Sans Devanagari, Noto Serif Devanagari and Kohinoor Devanagari.
- 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: Devanagari letters and signs in order, and whole words.
- Preeti: no Preeti font, as I found no license for it. Two converters wrote the 24 passages in Preeti codes, and three read them back. Where the writer and the reader are the same tool, it is a round trip.
- OCRmyPDF 17.13.0, pdftotext 26.03.0. Preview means PDFKit, the PDF engine of macOS 26.6.
What I did not test
- Real scans, old print, handwriting.
- A real Preeti PDF, or other old fonts such as Kantipur.
- Google Lens, paid OCR and AI models.
- EasyOCR and PaddleOCR, which list Nepali. Apple Live Text: its Vision reader lists 30 languages on macOS 26.6, and Nepali is not one of them.
Sources
Questions people ask
What is the best free OCR for Nepali?
On our 288 test pages, Tesseract's fast nep model: 98.4% of Nepali letters and 97.7% of whole words. The Hindi model hin got 93.4% of words.
How do I convert Preeti to Unicode?
Copy the Preeti text out, then run a converter. nep-ttf2utf, npttf2utf and legacy-fonts-to-unicode each got 98.0% of words or more back from our Preeti codes. For a scanned PDF, use OCR.
How do I convert a Nepali PDF to Word?
If the PDF has its own Unicode text, copy it with pdftotext: 96.1% of words whole. Preview kept 61.3%. For a scanned PDF, run OCRmyPDF with -l nep and --sidecar, then paste the text file into Word.