Skip to content

feat(domain): geometry, annotation and sample model - #4

Merged
hBouanane merged 3 commits into
feat/arabic-shapingfrom
feat/domain-model
Aug 12, 2026
Merged

feat(domain): geometry, annotation and sample model#4
hBouanane merged 3 commits into
feat/arabic-shapingfrom
feat/domain-model

Conversation

@hBouanane

Copy link
Copy Markdown
Collaborator

3 of 9 in the v1.0.0 series. Base: feat/arabic-shaping.

What

The contract between the renderers that produce pixels and the writers that serialise them. Immutable, pixel-free objects that can be built, reordered and serialised without touching an image.

  • geometry.pyBBox (ordering-normalised, with union / intersection / IoU / clip / normalise / pad) and Polygon for rotated or warped regions.
  • annotations.pyPage → Region → Line → Word, plus Table/TableCell.
    • Regions are typed with the layout categories document-layout benchmarks use, and carry an explicit reading order.
    • Page.to_html() / Page.to_markdown() — the supervision format document-to-markup models are trained against.
    • Table.to_otsl() — the tag sequence table-structure transformers consume, alongside HTML for TEDS scoring.
  • sample.pySample = image + Page + Provenance. Provenance records seed, font, background, renderer, shaper and every degradation, so a failure mode found months later can be traced to the setting that produced it.

Why it matters

The v0 pipeline returned (image, text, bbox, metadata). One box per page supervises nothing but a whole-page classifier. This is what makes word-level detection, layout analysis and table structure possible from the same render.

Verified

176 tests green (70 new).

hBouanane and others added 3 commits August 12, 2026 21:48
The contract between renderers and exporters. Immutable, pixel-free objects
that can be built, reordered and serialised without touching an image.

- geometry.py: BBox (ordering-normalised, with union/intersection/IoU/clip/
  normalise) and Polygon for rotated or warped regions.
- annotations.py: Page -> Region -> Line -> Word plus Table/TableCell.
  Regions are typed with layout categories used by document-layout
  benchmarks, carry an explicit reading order, and serialise the page back to
  HTML or Markdown - the supervision format document-to-markup models are
  trained against. Tables additionally emit OTSL for table-structure models.
- sample.py: Sample = image + Page + Provenance, where provenance records the
  seed, font, background, renderer, shaper and degradations so any single
  sample can be explained and regenerated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hBouanane
hBouanane merged commit 19951fb into feat/arabic-shaping Aug 12, 2026
5 checks 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.

1 participant