anaksor-ocr

អានអក្សរ

anaksor, “read the letters”

Khmer OCR for Python. Give it a photo, a scan or a PDF and get the text back in reading order.

pip install anaksor-ocr
Read the documentation

The letter is a public government document; the receipt and sign photos were found through web search and belong to their owners, shown only to illustrate the OCR output. Yours? Ask for credit or removal

Read a page

Connecting to the OCR API

Drop a photo, a scan or a PDF. The boxes show the lines found, numbered in reading order.

Images up to 10 MB, PDFs up to 30 MB (30 pages). Files are sent to the OCR API to be read.

What it does

Reading order
Columns, receipts and skewed phone photos come out in the order a person reads them; a price stays on its item's line.
Whole Khmer clusters
Subscripts, vowels and signs stay with their consonant, also where a long line is read in pieces and joined.
Exports
Plain text, JSON with every line's position and confidence, a searchable PDF, or a Word file with the layout rebuilt.
On your own computer
pip install anaksor-ocr runs on ONNX Runtime without PyTorch; add PyTorch for CUDA and Apple GPUs.

How well it reads

PartMeasured onResult
DetectionKhmerST validation photosprecision 0.75, recall 0.79
DetectionEnglish on photos (HierText)precision 0.76, recall 0.69
Recognition3,878 real lines: Khmer, Latin, mixed86.7% exactly right, 1.38% character error
Recognitionthe Khmer-only lines among them90.1% exactly right, 0.73% character error

Printed Khmer, documents, receipts and signs read best. English on photos and handwriting are weaker.

Use it from Python

The same models run in the package, on your own machine.

Python
import anaksor

ocr = anaksor.OCR()
result = ocr("letter.jpg")
print(result["text"])
CLI
anaksor scan.pdf -o scan.docx
# searchable PDF
anaksor scan.pdf -o scan-searchable.pdf

Everything else is in the documentation