Skip to content

API Reference parrot_loaders.ocr.tesseract

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

parrot_loaders.ocr.tesseract

View source

Tesseract OCR backend for parrot_loaders.

Uses pytesseract to extract text with bounding boxes from images. Words are grouped into paragraph-level blocks for structured output.

Alias OCRBlock

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

Class TesseractBackend

OCR backend using Tesseract via pytesseract.

Groups per-word Tesseract output into paragraph-level :class:OCRBlock objects. Each block covers a (block_num, par_num) group, which corresponds to a paragraph boundary as detected by Tesseract's page segmentation engine.

Parameter Type Default Description
language str 'en' Default ISO 639-1 language code (e.g. "en"). Mapped to a Tesseract language data file name at extract time.

Attributes:

Attribute Type Description
LANGUAGE_MAP Dict[str, str] Mapping from ISO 639-1 two-letter codes to the Tesseract language data file names (e.g. "en" -> "eng").

Method TesseractBackend.extract

Extract text blocks from image using Tesseract.

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

Parameter Type Default Description
image Image.Image A PIL/Pillow image to analyse.
language str 'en' ISO 639-1 language code used for Tesseract. Defaults to "en" (mapped to "eng").

Returns: List[OCRBlock] — A list of :class:OCRBlock objects, one per paragraph group, sorted in approximate reading order (top-to-bottom, then left-to-right).

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