Skip to content

API Reference parrot_loaders.ocr

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_loaders.ocr

View source

OCR subpackage for parrot_loaders.

Provides OCR backend abstraction, data models, and a factory function for selecting the best available OCR backend at runtime.

Alias LayoutLine

Re-exported from parrot_loaders.ocr.models.LayoutLine.

Alias LayoutResult

Re-exported from parrot_loaders.ocr.models.LayoutResult.

Alias OCRBackend

Re-exported from parrot_loaders.ocr.base.OCRBackend.

Alias OCRBlock

Re-exported from parrot_loaders.ocr.models.OCRBlock.

Function get_ocr_backend

Factory function to instantiate an OCR backend by name.

For name="auto" the function probes the installed packages in priority order and returns the first available backend: PaddleOCR > EasyOCR > Tesseract.

Backends are imported lazily so only the requested backend's dependencies need to be installed.

get_ocr_backend(name: str, language: str = 'en') -> OCRBackend

Parameter Type Default Description
name str Backend identifier. One of: "paddleocr", "tesseract", "easyocr", or "auto" (best available).
language str 'en' Default language code for the backend (e.g. "en").

Returns: OCRBackend — An instantiated OCR backend that satisfies the :class:OCRBackend protocol.

Raises:

  • ValueError — If name is not a recognised backend identifier.
  • ImportError — If the requested backend (or any backend for "auto") is not installed.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally