Document/Blueprint OCR Arsenal (no-stop fallback)
Unified OCR with a never-stop fallback chain. Best engine first, free fallbacks after — if one fails, the next runs automatically.
Chain (best → free)
1. LlamaParse (LlamaCloud) — best for complex docs/tables/blueprints/Visio. ✅ KEY verified (HTTP 200). 2. Mistral OCR 4 — primary Arabic OCR (MISTRAL_API_KEY). ~97% Arabic char-accuracy. 3. Gemini 3.1 Pro Vision — image/PDF understanding (GEMINI_API_KEY). 4. MinerU (offline) — FREE, fully offline, complex layout. See below. 5. Tesseract — local, free, Arabic+English.🆕 MinerU offline engine (added 2026-07-18)
Free + fully-offline document parser (opendatalab/MinerU 3.4.4), isolated in.venvs/mineru.
Best for: English/mixed docs + complex tables (→HTML, rowspan/colspan, cross-page merge, multi-column, reading order, header/footer removal) + privacy-sensitive KCPC docs (zero cloud upload) + RAG ingestion (PDF→Markdown).
Benchmarked (2026-07-18, real KFH statement, CPU pipeline): English+numbers+dates+tables = EXCELLENT. Arabic text emitted in VISUAL order → use --fix-arabic (bidi restore, verified «باسحلا مقر»→«رقم الحساب»). Stamps can trigger false-positive LaTeX → use --no-formula for non-math docs.
Honest role: MinerU = free/offline for English+mixed+tables. For Arabic-primary docs, Mistral OCR 4 stays primary. Highest accuracy (vlm-engine) needs GPU → use RunPod on demand; pipeline backend runs fine on our CPU.
bash
/data/.openclaw/workspace/.venvs/mineru/bin/python skills/document-ocr-arsenal/mineru_engine.py check
/data/.openclaw/workspace/.venvs/mineru/bin/python skills/document-ocr-arsenal/mineru_engine.py parse file.pdf -o /tmp/out --backend pipeline -l arabic --no-formula --fix-arabic
Usage (⚠️ source env first, run with /usr/bin/python3)
bash
. /data/.openclaw/secrets/env.sh
/usr/bin/python3 skills/document-ocr-arsenal/ocr_router.py check # which engines available now
/usr/bin/python3 skills/document-ocr-arsenal/ocr_router.py parse file.pdf # auto chain (LlamaParse first)
/usr/bin/python3 skills/document-ocr-arsenal/ocr_router.py parse img.png --engine gemini # force one
✅ Verified live (2026-06-05)
- LlamaParse key HTTP 200; supports pdf/docx/pptx/xlsx/images/Visio(.vsd/.vsdx)/epub/audio.
- check → all 4 engines true · parse via LlamaParse → clean markdown ("# Project Bridge 2026, Cost: 250,000 KWD").
- Fallback verified: when LlamaParse env not loaded, chain auto-fell back to Gemini (no stop).
Notes
- LlamaParse = أفضل للمخططات الهندسية المعقدة + الجداول (يربط مع engineering-ocr-blueprints).
- البدائل المجانية تضمن عدم التوقف أبداً (drop-in no-stop).