Files
Aislo/resources/tester/scratch/inspect_ch_5_9_12.py
T

48 lines
1.7 KiB
Python

import json
import sys
import re
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from scratch.enrich_tables import tables, get_chapter
sys.stdout.reconfigure(encoding='utf-8')
with open('resources/data_work_item_master/work_item_master_2026-01-01.json', 'r', encoding='utf-8') as f:
master = json.load(f)
master_tables = {}
wi_map = {}
for wi in master['work_items']:
for t in wi.get('tables', []):
tid = t.get('pum_table_id')
if tid:
master_tables[tid] = t
wi_map[tid] = wi
# Check chapter 5, 9, 12 specifically
for ch_num in ['제5장', '제9장', '제12장']:
print(f"\n==================== {ch_num} ====================")
ch_tables = [t for t in tables if ch_num in t['chapter']]
for t in ch_tables:
tid = t['table_id']
mt = master_tables.get(tid)
if not mt:
continue
m_qty = mt.get('basis_quantity')
m_unit = mt.get('basis_unit')
pform = mt.get('pum_form')
# Look for unit patterns in pre_context and headers
pre_text = " // ".join(t['pre_context'][-5:])
notes_text = " // ".join(t['notes'][:3]) if t['notes'] else ""
header_text = t['lines'][0].strip() if t['lines'] else ""
# Check if basis missing or interesting
if m_qty is None or m_unit is None or pform == 'reference':
print(f"[{tid} | line {t['start_line']}] sec: {t['section']}")
print(f" pre: {pre_text}")
print(f" hdr: {header_text}")
print(f" master basis: {m_qty} {m_unit} | form: {pform}")
if notes_text:
print(f" notes: {notes_text}")