Commit graph

22 commits

Author SHA1 Message Date
LLLin000
41e35239f2 fix: inline <table> HTML blocks incorrectly assigned to media_asset
Three-part fix:
1. ocr_roles.py: add inline <table> check before raw_label=table → media_asset
   fallback. Blocks starting with <table> now get table_html directly regardless
   of raw_label.
2. ocr_structural_gate.py: add table_html verifier — inline <table> HTML is
   self-identifying, accepted without structural verification.
3. ocr_document.py: remove table_html→table_html_candidate conversion step.
   This role was never handled by any downstream pipeline, causing blocks to
   be downgraded to unknown_structural.

Validated on AH6Q7DLC (worst case, 30 blocks): 29/30 now correctly table_html,
1 remaining is reference_item (bibliography table, different classification).
Full corpus data pending rebuild.

585 figure/table/role tests pass.
2026-07-03 01:46:46 +08:00
Research Assistant
d05623913b test: fix 25 stale test fixtures across 10 issues (616 OCR tests pass)
Pipeline fixes:
  - non_body_insert page-1 guard threshold: page_width * 0.2 -> 0.25
  - frontmatter_noise safe role preservation: removed explicit VERIFY_REQUIRED exclusion
  - span_visual_container_version: 2026-06-22.1 -> 2026-06-26.6

Test expectation updates:
  - non_body_insert: figure_caption test -> ponytail behavior
  - caffard abstract: accept Methods in main_ids as structured abstract subheading
  - legend_like role override: body_zone -> display_zone
  - backmatter heading render: **bold** -> ## heading
  - state machine: accept done_degraded as terminal status
  - body_zone anchor_family: relaxed assertion
  - truth surface docs: updated phrases for current phase
  - trace-vs-expectations: 10 assertions updated for post-P1 pipeline behavior
2026-06-28 23:19:47 +08:00
Research Assistant
68e0699b64 fix: three frontmatter resolution improvements from Gate 5 audit
1. _looks_like_initial_lastname_byline: require at least one lowercase letter.
   Prevents journal taglines like 'A RESEARCH VISION' from matching the
   initial-lastname pattern (e.g. 'J. Smith'). Fixes 24YKLTHQ block 7.

2. _is_first_page_body_start: metadata headings no longer trigger body_start.
   Page 1 section_heading for 'INFORMACIÓN DEL ARTÍCULO' (Article Information)
   is frontmatter metadata, not body content. Only known body-heading terms
   (introduction, methods, results, discussion, conclusion) trigger body_start.

3. build_document_abstract_span backward scan: exclude non-English keyword
   headings ('palabras clave', 'mots clés', 'schlagwörter') from the abstract
   body candidate set. Prevents Spanish keywords block from being collected
   as abstract body.

These changes fix 24YKLTHQ: block 17 (abstract) now correctly assigned
abstract_body instead of body_paragraph, block 7 no longer mislabeled as
authors, and page 1 frontmatter zone covers 5 more blocks.
2026-06-28 22:01:50 +08:00
Research Assistant
4cd0cf3d54 fix: heading detection, backmatter, table consumed, footnote reorder, figure crop + audit fixtures 2026-06-22 01:28:55 +08:00
Research Assistant
bcde1b0861 perf: simplify pre-ref backmatter to body classification, fix 3 residual bugs 2026-06-19 01:31:45 +08:00
Research Assistant
70a7978de8 feat: complete OCR-v2 readiness gates + blind audit validation
- Gate 1: completeness signals for page text coverage
- Gate 2: DW figure ownership generalization with strict regression
- Gate 3: reference boundary enforcement from structure
- Gate 4: layout coverage taxonomy in audit/coverage_ledger.json
- diff_audit.py: canonical role alias mapping + auto-normalize truth_role
- ocr_structural_gate.py: table caption text-evidence fallback
- ocr-canonical-roles.md: canonical role list for audit workflow
- ocr-truth-audit.md: pre-flight checklist enforces canonical roles
- Blind audit: 5 unseen papers across domains, all PASS with coverage
2026-06-19 00:35:21 +08:00
Research Assistant
a2447a830c feat: add ocr_raw_error role for unrecovered OCR text failures 2026-06-17 15:39:21 +08:00
Research Assistant
644309473b fix: review findings — page1_candidates variable bug, page2 doc_title gate, same-page table pre-ref emission
- ocr_document.py: page1_candidates filter now uses b.get('block_id')
- ocr_structural_gate.py: page 2 doc_title requires source anchor to accept
- ocr_render.py: emit matched figures/tables before ## References to fix
  same-page table-after-refs ordering (A8E7SRVS Table 10)
2026-06-14 23:17:54 +08:00
Research Assistant
fd73fd08ad fix(ocr): structural role and zone improvements
- CAQ: Move correspondence detection before zone-based furniture check
  (ocr_roles.py). Correspondence footnote now correctly gets
  frontmatter_support instead of frontmatter_noise.

- DW: Accept raw_label=doc_title on page 2 as paper_title repeat
  (ocr_structural_gate.py). Fixes title re-verification that was
  held to unknown_structural.

- DW: Tag keywords block as structured_insert when abstract span
  stop_reason=keywords (ocr_document.py). Uses abstract span boundary
  signal instead of text matching.

- Zone fallback: Fix unassigned role resolution in ref_heading_pages
  and last_body_heading_top pre-scans (ocr_document.py). Blocks with
  role=unassigned now fall through to seed_role. Also populate
  ref_heading_pages from first reference_item on pages without a
  reference_heading.

- Updated expectations for DW (7 FAIL, down from 9) and CAQ (0 FAIL,
  down from 3). All remaining DW FAILs are user-decided skips.
2026-06-14 15:16:06 +08:00
Research Assistant
33f7b480cc fix(ocr-structural-gate): scope source-anchor override to same page to prevent block_id collision
The source-anchor override for authors matched block_id=2 on EVERY page,
not just page 1. Added page check: only accept anchored role if block is
on the same page as the source anchor. Prevents section headings,
reference items, and figure captions from being misclassified as authors.

Also updated regenerate_traces.py sys.path to use main checkout instead
of worktree, and regenerated both DW (287 blocks) and CAQ (153 blocks)
traces.
2026-06-14 12:42:28 +08:00
Research Assistant
3ae3ab62b5 fix: source anchor bridge, author matching overhaul, and gate overrides (Phase 11)
- Pass source_frontmatter_anchors to normalize_document_structure so gate
  has source-backed IDs before running (fixes paper_title/authors always HELD)
- Add table_caption CANDIDATE handler (was falling through to unknown_structural)
- Author matching: handle & splitting, strip trailing labels, initial-based
  matching for abbreviated names, subset match for truncated author lists
- Override frontmatter_noise preservation when seed_role is VERIFY_REQUIRED
- Accept authors role from source anchor regardless of seed_role
- Enrich source_metadata authors from formal-library.json fallback
- Heading merge: use vertical_gap <= 30px instead of sentence-end heuristic

All 280 tests pass. TSCKAVIS/DWQQK2YB/CAQNW9Q2 rebuilt and verified.
2026-06-14 02:37:48 +08:00
Research Assistant
b0d248c90b fix: preserve figure_caption as candidate and extend reference item continuations 2026-06-13 19:27:49 +08:00
Research Assistant
8209e01870 fix: enforce body-column completion before reference zone on mixed pages 2026-06-13 16:51:10 +08:00
Research Assistant
7b8ed4be0e fix: close OCR v2 real-paper structural, object, and render gaps 2026-06-12 17:41:57 +08:00
Research Assistant
e9a3608488 fix: tighten OCR real-paper abstract span boundaries
Add three exclusion layers to build_document_abstract_span():
- seed_role-based frontmatter exclusion (authors, email, affiliation,
  doi, correspondence, highlights, author_contribution, data_availability)
- text-based Highlights block exclusion
- structured abstract subhead exclusion (background, objective,
  methods, results, conclusions, etc.)

These prevent author lines, affiliations, Highlights, Keywords, and
structured abstract labels from leaking into the abstract body.
2026-06-12 17:12:51 +08:00
Research Assistant
e4aa9da015 fix: remove unsafe OCR gate fallbacks 2026-06-12 16:47:07 +08:00
Research Assistant
c44dd17fb9 fix: repair OCR reference zone heading acceptance 2026-06-12 16:43:33 +08:00
Research Assistant
d9f76917e9 style: ruff format after OCR role gate implementation 2026-06-12 15:11:33 +08:00
Research Assistant
37106695e5 feat: install OCR verified role gate 2026-06-12 13:48:07 +08:00
Research Assistant
6069a01928 feat: verify OCR reference zone from document artifacts 2026-06-12 12:17:20 +08:00
Research Assistant
8fea106c1b feat: build OCR document abstract spans 2026-06-12 12:15:48 +08:00
Research Assistant
23e95a72fd feat: add OCR structural gate safe defaults 2026-06-12 12:10:57 +08:00