How sokhengdin/anaksor-ocr works
Anaksor is a Khmer OCR product for images, scans, and PDFs. Its main workflow accepts a page, detects text-line boxes, recognizes cropped lines, arranges them into reading order and paragraphs, then returns text/structured results or exports Word and searchable PDF. The repository also includes a browser demo and bilingual documentation. Edges reflect the README and shown source references; the browser-to-OCR service wiring and several unsampled implementation details are not verified here.
Main entry points: ocr.py OCR orchestration · detector.py Line detection · recognizer.py Line recognition · Demo.tsx Interactive demo
Components 26
Entry points
- Command line
src/anaksor/cli.py - OCR orchestration
src/anaksor/ocr.py
OCR pipeline
- Image and PDF input
src/anaksor/inputs.py - Line detection
src/anaksor/detector.py - Box extraction
src/anaksor/db_boxes.py - Crop geometry
src/anaksor/geometry.py - Line recognition
src/anaksor/recognizer.py - Long-line stitching
src/anaksor/longline.py - Reading-order layout
src/anaksor/layout.py - Khmer normalization
src/anaksor/text.py
Models and runtime
- Specs and weights
src/anaksor/models.py - Inference backends
src/anaksor/runtime.py - DBNet architectures
src/anaksor/nets/dbnet.py - Backbone networks
src/anaksor/nets/repvit.py - Network layers
src/anaksor/nets/layers.py - Inference fusion
src/anaksor/nets/fuse.py - Recognition decoding
src/anaksor/decoding.py
Results and exports
- OCR results
src/anaksor/ocr.py - Searchable PDF
src/anaksor/export/searchable_pdf.py - Word export
src/anaksor/export/word.py
Browser product
- Interactive demo
web/src/components/Demo.tsx - Demo API client
web/src/lib/api.ts - Bilingual documentation
web/src/content/docs-en.tsx
Other components
- User
- Browser user
- OCR service
Connections 28
- User → Command line: submits pages
README.md - Command line → OCR orchestration: runs OCR
- OCR orchestration → Image and PDF input: reads pages
src/anaksor/ocr.py - OCR orchestration → Line detection: detects lines
src/anaksor/ocr.py - Line detection → Specs and weights: resolves weights
src/anaksor/detector.py - Line detection → Inference backends: runs inference
src/anaksor/detector.py - Line detection → Box extraction: extracts boxes
src/anaksor/detector.py - Line detection → Crop geometry: uses geometry
src/anaksor/detector.py - Line detection → DBNet architectures: builds detector
- DBNet architectures → Backbone networks: uses backbone
src/anaksor/nets/dbnet.py - Backbone networks → Network layers: uses layers
src/anaksor/nets/repvit.py - Line detection → Inference fusion: fuses modules
src/anaksor/detector.py - OCR orchestration → Line recognition: recognizes crops
src/anaksor/ocr.py - Line recognition → Specs and weights: resolves weights
src/anaksor/recognizer.py - Line recognition → Inference backends: runs inference
src/anaksor/recognizer.py - Line recognition → Recognition decoding: decodes output
src/anaksor/recognizer.py - Line recognition → Khmer normalization: normalizes text
src/anaksor/recognizer.py - OCR orchestration → Long-line stitching: stitches long lines
src/anaksor/ocr.py - OCR orchestration → Reading-order layout: orders lines
src/anaksor/ocr.py - OCR orchestration → Crop geometry: crops lines
src/anaksor/ocr.py - OCR orchestration → OCR results: returns results
src/anaksor/ocr.py - OCR results → Searchable PDF: exports PDF
README.md - OCR results → Word export: exports Word
README.md - Browser user → Interactive demo: uploads pages
README.md - Interactive demo → Demo API client: requests OCR
web/src/components/Demo.tsx - Demo API client → OCR service: sends OCR request
- Interactive demo → Searchable PDF: requests export
- Browser user → Bilingual documentation: reads guides
README.md