Skip to main content

Core interfaces and utilities for OCR Bridge engine packages

Project description

OCR Bridge Core

Core interfaces and utilities for OCR Bridge engine packages.

Overview

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.

Installation

pip install ocrbridge-core

For local development, we recommend using uv and the provided Makefile.

See CONTRIBUTING.md for detailed setup instructions.

# Quick start (requires uv)
make install
make check

Core Components

OCREngine Base Class

All OCR engines must inherit from OCREngine and implement:

  • process(file_path, params) - Process a document and return HOCR XML
  • name property - Engine identifier (e.g., 'tesseract', 'easyocr')
  • supported_formats property - Set of supported file extensions

OCREngineParams

Base model for engine-specific parameters using Pydantic validation.

Exceptions

  • OCRBridgeError - Base exception
  • OCRProcessingError - Processing failures
  • UnsupportedFormatError - Unsupported file format
  • EngineNotAvailableError - Engine not installed/available
  • InvalidParametersError - Invalid parameters

HOCR Utilities

Helper functions for HOCR XML parsing, validation, and conversion:

  • parse_hocr() - Parse and extract HOCR information
  • validate_hocr() - Validate HOCR structure
  • extract_bbox() - Extract bounding box coordinates
  • easyocr_to_hocr() - Convert EasyOCR results to HOCR format

Implementing a New Engine

See the engine packages for examples:

  • ocrbridge-tesseract - Simple reference implementation
  • ocrbridge-easyocr - Deep learning with GPU support
  • ocrbridge-ocrmac - Platform-specific (macOS only)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocrbridge_core-3.0.0.tar.gz (92.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocrbridge_core-3.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file ocrbridge_core-3.0.0.tar.gz.

File metadata

  • Download URL: ocrbridge_core-3.0.0.tar.gz
  • Upload date:
  • Size: 92.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ocrbridge_core-3.0.0.tar.gz
Algorithm Hash digest
SHA256 465529828116305b4bbb40dbe175cb1d3ccdacead37f2dbbe03991c9eafac3d7
MD5 b5b0fcc0ba76a733989e22101d4723d2
BLAKE2b-256 2cc0bb6b91d357a83cd1ddb6d6022c780a5a23e2e0c7d0fde9e4860b6e34db57

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocrbridge_core-3.0.0.tar.gz:

Publisher: release.yml on OCRBridge/ocrbridge-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ocrbridge_core-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: ocrbridge_core-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ocrbridge_core-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7052f5ff30597c56a849a22121225a7f499b8f18bb14701b3110a4cc4e115441
MD5 6de0dd73332874beaaad8ac9b694b6c4
BLAKE2b-256 ce560fa2815585049a33e8161cd8a373bc4db2d8900a7f55e4c393b4df8110e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocrbridge_core-3.0.0-py3-none-any.whl:

Publisher: release.yml on OCRBridge/ocrbridge-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page