Core interfaces and utilities for OCR Bridge engine packages.
ocrbridge-core provides the foundational abstract base classes, models, and utilities that all OCR engine packages must implement. This package enables a modular, plugin-based architecture where OCR engines can be dynamically discovered and loaded at runtime.
pip install ocrbridge-coreFor local development, we recommend using uv and the provided Makefile.
See CONTRIBUTING.md for detailed setup instructions.
# Quick start (requires uv)
make install
make checkAll OCR engines must inherit from OCREngine and implement:
process(file_path, params)- Process a document and return HOCR XMLnameproperty - Engine identifier (e.g., 'tesseract', 'easyocr')supported_formatsproperty - Set of supported file extensions
Base model for engine-specific parameters using Pydantic validation.
OCRBridgeError- Base exceptionOCRProcessingError- Processing failuresUnsupportedFormatError- Unsupported file formatEngineNotAvailableError- Engine not installed/availableInvalidParametersError- Invalid parameters
Helper functions for HOCR XML parsing, validation, and conversion:
parse_hocr()- Parse and extract HOCR informationvalidate_hocr()- Validate HOCR structureextract_bbox()- Extract bounding box coordinateseasyocr_to_hocr()- Convert EasyOCR results to HOCR format
See the engine packages for examples:
ocrbridge-tesseract- Simple reference implementationocrbridge-easyocr- Deep learning with GPU supportocrbridge-ocrmac- Platform-specific (macOS only)