lllin000_PaperForge/_check_ct.py
Research Assistant 463cd4d7b1 fix: references, figure matching, and OCR structural fixes
- Fix references zone detection without heading (backward reference fallback)
- Fix reference_item silently dropped in _reorder_tail_run_fifo when no heading
- Fix figure proximity matching: use nearest legend regardless of column order
- Fix figure numbering in extract_and_write_objects: use actual figure_id
- Fix body→reference_item rescue: require text starts with numeric ref pattern
- Fix tail reading order rebuilt after block normalization
- A8E7SRVS: corrected figure-legend pairing on page 5
- CAQNW9Q2: references now render without heading
- K7R8PEKW: adjusted body retention threshold
2026-06-07 22:27:58 +08:00

25 lines
1,003 B
Python

import json, sys
from pathlib import Path
sys.stdout.reconfigure(encoding="utf-8")
p = Path(r"D:\L\OB\Literature-hub\System\PaperForge\ocr\TSCKAVIS\structure\blocks.structured.jsonl")
rows = [json.loads(line) for line in p.read_text(encoding="utf-8").splitlines() if line.strip()]
for i in range(123, 132):
r = rows[i]
ctxt = r.get("_container_text") or ""
print(i, r.get("role"), "has_ct=" + str(bool(ctxt)), r.get("bbox"),
(r.get("text") or "")[:100],
"|CT:" + ctxt[:160] if ctxt else "")
print("---")
ftxt = Path(r"D:\L\OB\Literature-hub\System\PaperForge\ocr\TSCKAVIS\fulltext.md").read_text(encoding="utf-8", errors="replace")
for needle in ["Box 1", "mitochondrial", "Osteoarthritic"]:
idx = ftxt.lower().find(needle.lower())
if idx != -1:
line_start = ftxt.rfind("\n", 0, idx) + 1
line_end = ftxt.find("\n", idx)
ctx = ftxt[max(0, idx-40):idx+120]
print(needle, "->", ctx)
else:
print(needle, "-> NOT FOUND")