tesseract-rs: recognize_document one-shot + tesseract-ogar OCR v2 executor#35
Merged
Merged
Conversation
…cutor
The tesseract-rs half of the OGAR OCR action-table v2 (companion to the
ogar-vocab 8->14 growth). Lands in lockstep — the const-assert fuse
(tesseract-ogar/src/lib.rs) makes the interim a hard workspace compile
failure, so merge the OGAR PR first.
- tesseract-ocr: LstmRecognizer::recognize_document — the canonical
one-shot composition (word recognition -> doc.v1 DOM -> numeric
hardening -> optional typed harvest -> region classification via page
furniture + XY-cut blocks + halftone figures -> doc.v1 JSON), returning
a Document { json, fields, word_count, line_count }. The halftone_figures
helper factors out the Otsu->generate_halftone_mask->conn_comp_bb chain.
This is now the SINGLE source of truth: the web demo's JSON arm is
refactored onto it (dropping ~50 lines of duplicated composition), and
the tesseract-ogar recognize_document arm calls it too, so the two
consumers cannot drift.
- tesseract-ogar: six new OcrRequest/OcrResponse variants + execute arms +
capability_of + param mappings, all thin dispatch onto the proven
tesseract-ocr API: recognize_page_words, recognize_document,
harvest_fields, segment_page, detect_halftone_regions,
detect_page_furniture. COVERED_CAPABILITIES 8->14 (the const-assert +
the name-level fuse test now cover 14); the hotplug test asserts the
new page_layout subject. harvest_profile is fail-closed
(UnknownHarvestProfile) so a typo can never silently drop invoice-field
validation — only "german_invoice" is understood today.
137/137 tesseract-ocr lib tests (+recognize_document), 9/9 tesseract-ogar
(all fuse tests green), 8/8 web; clippy -D warnings clean on all four
crates. Railway: the web crate ships this in the next master deploy (the
JSON mode now runs the shared one-shot).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_1be808ce-4499-4d5b-b9e4-c79fc69a857a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
recognize_documentone-shot + tesseract-ogar OCR v2 executorThe tesseract-rs half of the OGAR OCR action-table v2 (companion to AdaWorldAPI/OGAR#188,
ogar-vocab8→14).tesseract-ocr:LstmRecognizer::recognize_document— the canonical one-shot composition (word recognition →doc.v1DOM → numeric hardening → optional typed harvest → region classification via page furniture + XY-cut blocks + halftone figures →doc.v1JSON), returningDocument { json, fields, word_count, line_count }. Now the single source of truth: the web demo's JSON arm is refactored onto it (−50 lines of duplicated composition), and thetesseract-ogarrecognize_documentarm calls it too, so the two consumers cannot drift.tesseract-ogar: six newOcrRequest/OcrResponsevariants +executearms +capability_of+ param mappings — all thin dispatch onto the proventesseract-ocrAPI.COVERED_CAPABILITIES8→14;harvest_profileis fail-closed (UnknownHarvestProfile) so a typo can never silently drop invoice-field validation.⚠ Merge order: merge OGAR#188 first. The
const _assert (tesseract-ogar/src/lib.rs) comparesogar_vocab::ocr_actions::OCR_ACTION_NAMES.len()against this crate'sCOVERED_CAPABILITIES.len()— until OGAR main is at 14, this workspace failscargo build(the sibling path-dep). Both must land.Council: authored via the 5+3 pattern — 5 verification savants → consolidate → 3 brutal reviewers, all CLEAN, 0 findings.
Tests: 137/137 tesseract-ocr lib (+
recognize_document), 9/9 tesseract-ogar (all fuse tests), 8/8 web; clippy-D warningsclean on all four crates. The web crate ships this in the next Railway master deploy — JSON mode now returns real classifiedregions[]+ typedfieldsvia the shared one-shot.🤖 Generated with Claude Code
https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1