feat(diagrams): one box per page-band — capture 100 % of figures, model decides (T-080, closes T-078) - #161
Open
Ztein wants to merge 4 commits into
Open
feat(diagrams): one box per page-band — capture 100 % of figures, model decides (T-080, closes T-078)#161Ztein wants to merge 4 commits into
Ztein wants to merge 4 commits into
Conversation
…ions, model decides (T-080) Phase 2 of the capture-100% work; NOT mergeable until T-081 (structured describe) lands, because the relaxation over-captures vector content on LibreOffice-rendered Office docs and the fragile [SKIP] string lets one junk region leak. Validated on native PDFs: BoC 58->100%, BoJ 79->100%, precise. Removes MIN_SOLID gate + the solid machinery; keeps region-finding + size floor + table-dedup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…en visuals (T-080) Replaces union-find clustering + y-gap split + per-cluster floors with vertical banding: a page's vector content unions into one box per band, and two bands are separate figures only when a body paragraph sits between them. Captions and source lines do not split — they belong to the figure and land inside the box. Bench (BoC MPR 2024-10, BoJ Outlook 2024-10, BIS AR 2024, Fed MPR 2024-07, Riksbank PPR 2025-03), geometric caption coverage: - coverage 100 % on all five (main: BoC 58 %, BoJ 79 %) - region counts bounded: 35/54/81/64/44 — aggregate 301→284 vs main over seven docs, no explosion (BIS halves: panels merge; BoC/Fed double where main dropped 1 in 4 figures) - paragraph = >=20 words, >=2 lines, sentence punctuation (bench-validated: word counts alone overlap — BIS panel titles run 15-44 words; punctuation separates tick-label runs, junk 107->0 words) A body paragraph inside a region is never suppressed from the body text (text_block_in_region grows a text guard): one-box bands can legitimately cover flowing text, and mild duplication beats silent deletion. Full-span drawings (margin rules, borders) are filtered as page furniture so they cannot bridge every band into a full-page box. A ruled table that find_tables misses is now captured for the model instead of dropped (T-050 symptom); tables the table path owns are excluded before banding, as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…~flat Live end-to-end runs (gemma-4-31B via Berget) recorded in scripts/coverage_bench/BASELINE.md: BoC 26/26, BoJ 58/58 captions covered, no misses; T-081 skips absorb over-capture cleanly (3/35, 4/59, no junk). Live pipeline test updated to the one-box contract (p68 merges to one box). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d and described live (28/28) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ztein
enabled auto-merge (squash)
July 22, 2026 20:21
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.
What
Replaces the chart-classification detector (union-find clustering, y-gap split, per-cluster floors, solid-fill gates) with one box per page-band: a page's vector content unions into one box per vertical band, and two bands are separate figures only when a body paragraph sits between them. No chart/not-chart judgement remains in code — the vision model decides what each box is, and T-081's structured
is_figureskips the non-figures.Closes T-080 and T-078 (the dropped bar/combo charts fell to the very gates this removes).
Bench — before → after
Live end-to-end runs (gemma-4-31B via Berget, 2026-07-22), caption coverage per
scripts/coverage_bench:Geometric coverage also 100 % on bis-ar-2024, fed-mpr-202407, riksbank-ppr-202503. Cost ~flat: 301→284 regions aggregate over seven corpus docs (BIS halves — multi-panel figures merge; BoC/Fed roughly double, exactly where main dropped 1 in 4 figures). Full-conversion cost: BoC 0.016 EUR, BoJ 0.030 EUR, FSR 0.019 EUR.
Decisions (bench-validated, no arbitrary limits)
diagrams.pycomments + T-080 resolution.find_tablesmisses is now captured for the model instead of dropped (addresses the T-050 symptom).Simpler, not detuned
_close/_cluster_rects/_split_by_y_gap,MERGE_DISTANCE,MIN_DRAWINGS_PER_CLUSTER,INTERNAL_Y_GAP_SPLITall deleted; two bench-validated constants added (PARA_MIN_WORDS/LINES). Net −206/+277 including tests and docs.Tests
scripts/coverage_bench/BASELINE.md.🤖 Generated with Claude Code