Skip to content

tesseract-rs: recognize_document one-shot + tesseract-ogar OCR v2 executor#35

Merged
AdaWorldAPI merged 1 commit into
masterfrom
claude/happy-hamilton-0azlw4
Jul 10, 2026
Merged

tesseract-rs: recognize_document one-shot + tesseract-ogar OCR v2 executor#35
AdaWorldAPI merged 1 commit into
masterfrom
claude/happy-hamilton-0azlw4

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

recognize_document one-shot + tesseract-ogar OCR v2 executor

The tesseract-rs half of the OGAR OCR action-table v2 (companion to AdaWorldAPI/OGAR#188, ogar-vocab 8→14).

  • 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 Document { 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 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. COVERED_CAPABILITIES 8→14; harvest_profile is 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) compares ogar_vocab::ocr_actions::OCR_ACTION_NAMES.len() against this crate's COVERED_CAPABILITIES.len() — until OGAR main is at 14, this workspace fails cargo 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 warnings clean on all four crates. The web crate ships this in the next Railway master deploy — JSON mode now returns real classified regions[] + typed fields via the shared one-shot.

🤖 Generated with Claude Code

https://claude.ai/code/session_016b33swuXE23hKtqxsHu9p1

…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
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@AdaWorldAPI AdaWorldAPI merged commit a5a98ed into master Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants