OCR types

ocr.Box

Pixel rectangle in top-left-origin image coordinates.

Usage

Source

ocr.Box(
    x,
    y,
    width,
    height,
)

Parameter Attributes

x: int
y: int
width: int
height: int

ocr.OcrToken

A single recognized token with its bounding box and recognizer confidence.

Usage

Source

ocr.OcrToken(text, box, confidence)

Parameter Attributes

text: str
box: Box
confidence: float

ocr.Document

A page read by a document-OCR engine.

Usage

Source

ocr.Document(markdown, tokens=())

Parameter Attributes

markdown: str
tokens: tuple[OcrToken, …] = ()

Attributes

Name Description
text The markdown stripped of formatting: headings, emphasis, and table pipes
text

The markdown stripped of formatting: headings, emphasis, and table pipes

text: str

removed, cell text preserved, code fences unwrapped, into plain lines.

ocr.TokenOcr

Token-level OCR: geometry + confidence per token (the ensemble substrate).

Usage

Source

ocr.TokenOcr()

ocr.DocOcr

Page-level document OCR (VLM engines): image in, structured markdown out.

Usage

Source

ocr.DocOcr()