Documentation
¶
Overview ¶
Package tesseract reads page images with the tesseract CLI, run as a subprocess when it is installed (ADR 0043). No CGO: the binary is found on PATH or at a configured path, and a run without it falls back as the caller decides.
Tesseract and not a vision model, from a spike on 8 pages, each clean at 300 dpi and scan-like at 150 (issue #9, re-run 2026-10-20 with Google's documented OCR prompt): Tesseract 5.5.3 read them at a median CER of 2.3% and 3.3%, Gemma 4 E4B at 5.9% and 5.2% in its best shape and 32% or worse with Google's question. Gemma's errors also carry no confidence, and Tesseract's do: at 90 or more, 99.4% of its words were right.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("tesseract not found: install it, or name it with -tesseract")
ErrNotFound reports that no tesseract executable was found.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is an ocr.Engine backed by the tesseract CLI.
type Options ¶
type Options struct {
// Exe is the tesseract executable. Empty looks for "tesseract" on PATH.
Exe string
// TessData is the directory holding the language models. Empty leaves it to
// TESSDATA_PREFIX or the installation's default.
TessData string
// Lang is the language model, "eng" when empty.
Lang string
// DPI is the resolution the images are rendered at. Zero lets Tesseract estimate it, which
// it does from the text and gets wrong on a sparse page.
DPI float64
}
Options configure an Engine.