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,61 @@
|
||||
import re,json,hashlib
|
||||
from pathlib import Path
|
||||
B=Path('plans/extract-remaining-elements')
|
||||
batch=json.loads((B/'batch_2.json').read_text())
|
||||
def subsections(t):
|
||||
ms=list(re.finditer(r'(?m)^(#{2,3}) (?:§)?(\d+(?:\.(?:P\d+|\d+))?)\.?[^\n]*',t)); out={}
|
||||
for i,m in enumerate(ms):
|
||||
out[m[2]]=(m[0],t[m.end():ms[i+1].start() if i+1<len(ms) else len(t)].strip())
|
||||
return out
|
||||
def clean(t):
|
||||
t=re.sub(r'\[([^\]\n]+)\]\(https?://[^\s)]+\)',r'\1',t)
|
||||
t=re.sub(r'https?://[^\s<>|)]+','',t)
|
||||
# Source sections remain locators even when not carried over.
|
||||
t=re.sub(r'(?<!원문 )§(?=\d)', '원문 §',t)
|
||||
t=re.sub(r'(?m)^.*\*\*(?:증명 실무|표준 서증|증거자료|증거방법)\*\*[^\n]*(?:\n[ \t]+[^\n]+)*','',t)
|
||||
t=re.sub(r'(?m)^- \*\*(?:추정·전환|다중 대응)\*\*: (?:없음|해당 없음)\.?\s*$','',t)
|
||||
t=re.sub(r'\n{3,}','\n\n',t)
|
||||
return t.strip()
|
||||
def tables(body):
|
||||
return '\n\n'.join(m[0] for m in re.finditer(r'(?m)^\|[^\n]*(?:\n\|[^\n]*)+',body))
|
||||
def meta(t,k,default=''):
|
||||
m=re.search(r'^'+k+r':\s*[\"\']?([^\n\"\']*)',t,re.M); return m[1] if m else default
|
||||
for x in batch:
|
||||
p=Path(x['source']); t=p.read_text(); sec=subsections(t)
|
||||
name=meta(t,'case_kind_name',x['case']); source='../raw/'+p.name
|
||||
header=f'''---\ncase_kind_id: "{meta(t,'case_kind_id')}"\ncase_kind_name: "{name}"\ndoc_version: "v2"\ndocument_type: "요건사실 항목 추출"\nsource_file: "{source}"\nsource_sha256: "{x['sha256']}"\nsource_law_as_of: "{meta(t,'law_as_of')}"\nsource_verification_status: "{meta(t,'verification_status')}"\nextraction_date: "2026-09-28"\nverification_scope: "원문 대비 추출 검증; 법령·판례 독립 재검증 미실시"\n---\n\n# 요건사실 항목 추출: {name}\n\n[지정 원문]({source})에서 청구취지·청구원인 작성에 필요한 내용을 추출하였다. 법리·근거·검증상태와 적용 기준일은 원문 기준이며, 현행법에 대한 독립 검증 결과가 아니다. 원문 요건 ID와 권위 ID를 유지한다. LAW는 조문, PREC는 원문 판례, BOOK:RF13은 제13판 면수다. 본문의 `원문 §…` 및 6.x 항변번호는 원문 위치를 가리킨다. 순수 출처 목록·URL·조사 이력은 원문에 보존하며, 이 문서의 UNKNOWN·UNVERIFIED·QUALIFIED 표시는 원문의 한계를 승계한다.\n'''
|
||||
chunks=[header]
|
||||
def add(key, title=None,table=False):
|
||||
if key not in sec:return
|
||||
h,b=sec[key]; b=tables(b) if table else b
|
||||
if b:chunks.append((title or h)+'\n\n'+clean(b))
|
||||
add('1.1','## 1. 청구경로 선택',True)
|
||||
add('1.2','### 경로의 관계와 병합 조건')
|
||||
# Scope and exclusions affect pathway selection and remain linked.
|
||||
add('1.4','### 적용 제외와 경계')
|
||||
chunks.append('## 2. 당사자·소의 이익·기간')
|
||||
for k in ['3.1','3.2','3.3']:add(k)
|
||||
chunks.append('## 3. 공통·경로별 요건사실')
|
||||
# If common blocks exist, avoid duplicate catalogue but retain material introductory qualification.
|
||||
if '4.2' in sec and re.search(r'(?m)^#{3,6} .*R-',sec['4.2'][1]):
|
||||
add('4.2')
|
||||
else:
|
||||
add('4.1');add('4.2')
|
||||
for k in sec:
|
||||
if re.fullmatch(r'5\.P\d+',k):add(k)
|
||||
chunks.append('## 4. 부인·항변·재항변')
|
||||
for k in sec:
|
||||
if re.fullmatch(r'6\.\d+',k):add(k)
|
||||
# Often table aggregates burden and exposes conflicts; retain only rows not full duplicates later.
|
||||
add('7','### 주장·증명책임 연결표')
|
||||
add('8.4','### 증명책임·추정과 증명 곤란의 한계')
|
||||
chunks.append('## 5. 주문 특정과 부수급부')
|
||||
add('2.2','### 요건 조합과 주문의 대응')
|
||||
add('4.4','### 부수급부의 적용 조건·기간·이율')
|
||||
add('10.4','### 청구취지 특정 조건')
|
||||
add('12.6','## 6. 요건 분류·증명책임에 영향을 주는 논의')
|
||||
chunks.append('## 7. 적용 유보와 미해결\n\n<!-- CASE_REVIEW_LIMITS -->')
|
||||
o=Path(x['output']);o.parent.mkdir(exist_ok=True)
|
||||
if o.exists():raise RuntimeError('output already exists '+str(o))
|
||||
o.write_text('\n\n'.join(chunks).strip()+'\n')
|
||||
print('DRAFTS',len(batch))
|
||||
Reference in New Issue
Block a user