Skip to content

API Reference parrot_loaders.ocr.base

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

parrot_loaders.ocr.base

View source

OCR Backend Protocol definition.

Defines the structural interface that all OCR backend implementations must satisfy. Uses Python's Protocol (structural subtyping) so backends don't need to explicitly inherit from this class.

Class OCRBackend

Protocol for OCR backends.

All OCR backends must implement this interface. The Protocol uses structural subtyping (duck typing) so backends do not need to explicitly inherit from this class.

Method OCRBackend.extract

Run OCR on an image and return text blocks with bounding boxes.

extract(image: Image.Image, language: str = 'en') -> List[OCRBlock]

Parameter Type Default Description
image Image.Image PIL Image to process.
language str 'en' ISO language code for OCR (e.g., "en", "fr", "de"). Backend implementations handle language code mapping.

Returns: List[OCRBlock] — List of OCRBlock objects, each containing extracted text, bounding box coordinates, and confidence score.

Alias OCRBlock

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

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