ek.ocr.bridge#
The ocracy bridge: turn the OCR fleet into an image -> OcrResult callable.
ocracy is a deliberately dependency-free facade over ~16 OCR engines whose
single entry point ocracy.ocr(image, *, backend=None, **kwargs) returns a
normalized OcrResult (.text plus .blocks carrying [0, 1]-normalized
confidence and geometry). ek consumes that shape rather than reinventing engine
integration. The bridge is intentionally tiny – it only adapts ocracy’s call
into the OcrBackend contract and guards the optional dependency
with an actionable install hint.
Null-safety reminder (see misc/docs/ek_01): VLM/markdown engines (Claude,
GPT-4o, Mistral OCR) return text only – blocks == [] and confidence is
None. Any code reading confidence/geometry off the result must tolerate None.
Functions
|
Return an |
|
Convenience: OCR an image and return just the recognized text string. |
- ek.ocr.bridge.ocracy_backend(backend=None, **default_kwargs)[source]#
Return an
image -> OcrResultcallable bound to oneocracybackend.- Parameters:
- Return type:
- Returns:
A callable suitable for
ek.ocr.evaluate_ocr().