import json import sys from pathlib import Path sys.stdout.reconfigure(encoding='utf-8') # Load 1st audit results with open('resources/knowledge/technical_info/01_임도/05_원가정보/품셈_원문md_마스터데이터_대조_검증보고서.json', 'r', encoding='utf-8') as f: audit_v1 = json.load(f) refs_27 = audit_v1['item5_references'] # Load enriched tables to get original MD lines sys.path.insert(0, '.') from scratch.enrich_tables import tables tables_by_id = {t['table_id']: t for t in tables} print(f"Analyzing all {len(refs_27)} suspect reference tables from original MD:\n") for r in refs_27: tid = r['table_id'] t = tables_by_id.get(tid) if not t: continue print(f"==================== [{tid} | Line {t['start_line']}] {t['chapter']} | {t['section']} ====================") # Print pre-context (last 5 lines before table) print("--- Pre-context ---") for pl in t['pre_context'][-5:]: print(f" {pl}") print("--- Table Header & First 2 Rows ---") for tl in t['lines'][:4]: print(f" {tl.strip()}") if t['notes']: print("--- Notes ---") for n in t['notes'][:3]: print(f" {n}") print()