Commit 371ed55
feat(domain): add geometry, annotation and sample model
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>1 parent 5cae3c4 commit 371ed55
9 files changed
Lines changed: 1308 additions & 15 deletions
File tree
- src/ocrsmith
- datasets/loaders
- domain
- text
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 91 | + | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments