chore: snapshot of work since 2026-10-05 (Stage 1 v.8, S2_00 v7.4/v7.5 handoff, S2_10 rewrite research v.2, 청구취지·요건사실 corpora)
Case_02_Comparison_Research - Stage 1 v.8: Part 1~4 YAMLs with R1~R3 patches, F-1/F-2 fixes, 피고과식별방지 prompt (defendant_qualification), dated backups, 실행검사/실패분석 reports - Stage 2 S2_00: v7.4 handoff (Task_S2_00_handoff, 경량화 전략서 + §2 개정) and v7.5 defendant qualification gate (피고관련작업_개정_S2_00.md), copies v.7/v.10/v.11, dated backups, 실행보고서/실패분석/결과물 리스트 - Stage 2 S2_10: v6/v7/v8 failure analyses, 재작성전략 10_06/10_08, case_kind_registry.json, 연구조사보고서_S2_10_재작성용.md (v.1), _추가.md (multi-claim methodology) and merged _v.2.md (claims[] 1~4, join PRELIMINARY/SELECTIVE/INDEPENDENT, V1~V6), S2_10_Test run outputs, 실행검사 v.10/v.11 - Stage_2 MEMORY.md / CLAUDE.md / work-history notes, AGENTS.md and README_KO.md updates Other corpora and tooling - Default_Agent_청구취지기재방법: 청구취지 규칙문서 전체 모음(원문·사건종류별·raw) and tmp drafts - 요건사실론: 사건종류별 문서(raw·filtered), plans, rf_draft - 판례모음, STT_앱구성_연구, API Crowdness 조사, update_numbers.py Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import re,json,hashlib
|
||||
from pathlib import Path
|
||||
B=Path('plans/extract-remaining-elements');batch=json.loads((B/'batch_2.json').read_text()); rows=[]
|
||||
idpat=r'R-PROV\d+-[45]-\d+'
|
||||
def definitions(t):
|
||||
return [(m[1],m.start()) for m in re.finditer(r'(?m)^#{3,6} [^\n]*\b('+idpat+r')\b[^\n]*',t)]
|
||||
def blocks(t):
|
||||
d=definitions(t);out={}
|
||||
for i,(rid,pos) in enumerate(d):
|
||||
seg=t[pos:d[i+1][1] if i+1<len(d) else len(t)];seg=re.split(r'(?m)^#{2,3} ',seg,1)[0] if not seg.startswith('### ') else seg
|
||||
out[rid]=seg
|
||||
return out
|
||||
for x in batch:
|
||||
src=Path(x['source']);op=Path(x['output']);s=src.read_text();o=op.read_text();sd=definitions(s);od=definitions(o);issues=[]
|
||||
if hashlib.sha256(src.read_bytes()).hexdigest()!=x['sha256']:issues.append('source changed')
|
||||
if set(a for a,_ in sd)!=set(a for a,_ in od):issues.append('definition ID set differs')
|
||||
if len(od)!=len(set(a for a,_ in od)):issues.append('duplicate element definitions')
|
||||
if len(re.findall(r'(?m)^# ',o))!=1:issues.append('H1 count')
|
||||
if len(re.findall(r'(?m)^```',o))%2:issues.append('fence parity')
|
||||
if re.search(r'https?://',o):issues.append('URL remains')
|
||||
if 'CASE_REVIEW_LIMITS' in o:issues.append('review placeholder')
|
||||
# Each original element authority field must appear in the corresponding output element.
|
||||
for rid,pos in sd:
|
||||
sm=re.search(r'(?m)^- \*\*권위 ID\*\*[^\n]*',s[pos:])
|
||||
om=next((p for r,p in od if r==rid),None)
|
||||
if om is None:continue
|
||||
following=[p for r,p in od if p>om];oe=min(following) if following else len(o);ob=o[om:oe]
|
||||
if sm:
|
||||
authorities=re.findall(r'(?:LAW|PREC|BOOK):[^\s,;|`]+',sm[0])
|
||||
if any(a.rstrip('.') not in ob for a in authorities):issues.append('authority mismatch '+rid)
|
||||
# Path headings are preserved.
|
||||
paths=set(re.findall(r'(?m)^### (5\.P\d+) ',s));opths=set(re.findall(r'(?m)^### (5\.P\d+) ',o))
|
||||
if paths!=opths:issues.append('path set differs')
|
||||
# Markdown tables: logical pipe delimiter counts; escaped pipes ignored.
|
||||
tables=[]
|
||||
for m in re.finditer(r'(?m)^\|[^\n]*(?:\n\|[^\n]*)+',o):
|
||||
ls=m[0].splitlines()
|
||||
if len(ls)<2:continue
|
||||
counts=[len(re.split(r'(?<!\\)\|',l))-2 for l in ls]
|
||||
if len(set(counts))>1:tables.append({'line':o[:m.start()].count('\n')+1,'widths':sorted(set(counts))})
|
||||
if tables:issues.append('table widths '+str(tables))
|
||||
rows.append({'case':x['case'],'defined_elements':len(od),'paths':len(paths),'source_bytes':len(s.encode()),'output_bytes':len(o.encode()),'reduction_pct':round(100*(1-len(o.encode())/len(s.encode())),1),'issues':issues})
|
||||
(B/'agent2_validation.json').write_text(json.dumps(rows,ensure_ascii=False,indent=2)+'\n')
|
||||
print(json.dumps({'files':len(rows),'elements':sum(r['defined_elements'] for r in rows),'paths':sum(r['paths'] for r in rows),'aggregate_reduction_pct':round(100*(1-sum(r['output_bytes'] for r in rows)/sum(r['source_bytes'] for r in rows)),1),'issues':[{r['case']:r['issues']} for r in rows if r['issues']]},ensure_ascii=False,indent=2))
|
||||
Reference in New Issue
Block a user