Files
Liti-agent-Development/Default_Agent_청구취지기재방법/tmp/check_말소등기대위.py
T
jhogyuandClaude Fable 5.1 5f9853e44b 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>
2026-10-12 13:02:13 +09:00

80 lines
4.2 KiB
Python

# -*- coding: utf-8 -*-
import io,re,hashlib,collections
P="0_사건종류_추가/사건종류_말소등기대위에의한소유권이전등기말소청구/청구취지작성규칙_말소등기대위에의한소유권이전등기말소청구_v2.md"
raw=io.open(P,"rb").read()
s=raw.decode("utf-8")
lines=s.split("\n")
print("UTF-8 decode: OK")
print("lines(개행수 기준) =",len(lines)-1 if s.endswith("\n") else len(lines))
print("bytes =",len(raw))
print("sha256 =",hashlib.sha256(raw).hexdigest())
print("미치환 토큰 =",len(re.findall(r"\{\{|<사건키>|\[사건종류\]",s)))
print("## 절 수 =",sum(1 for l in lines if l.startswith("## ")))
secs=[l for l in lines if re.match(r"^## \d+\.",l)]
print("번호 절 =",len(secs),[re.match(r"^## (\d+)",l).group(1) for l in secs])
print("코드펜스 =",sum(1 for l in lines if l.startswith("```")))
print("후행 공백 행 =",sum(1 for l in lines if re.search(r"[ \t]+$",l)))
IDPAT=r"\b(?:Q|RULE|LEAF|FORM|CHECK|STOP|SRC)-[A-Za-z0-9]+"
refs=collections.Counter(re.findall(IDPAT,s))
defs=set()
for l in lines:
m=re.match(r"^[-*|#`>\s]*\**\s*("+IDPAT.strip(r"\b")+r")",l)
if m: defs.add(m.group(1))
# 표 머리글 제외
hdr={"LEAF-ID","FORM-ID","CHECK-ID","STOP-ID","RULE-ID","Q-ID","SRC-ID"}
orph=[k for k,v in refs.items() if v==1 and k not in hdr]
print("고아 ID(1회 등장) =",len(orph),sorted(orph))
und=sorted(k for k in refs if k not in defs and k not in hdr)
print("정의 없는 참조 =",len(und),und)
rng=[ (i+1,l) for i,l in enumerate(lines) if re.search(r"(CHECK|FORM|LEAF|STOP|RULE|Q)-[0-9A-Za-z]+ ?(~|내지|부터) ?(CHECK|FORM|LEAF|STOP|RULE|Q)?-?[0-9]|(CHECK|FORM|LEAF|STOP|RULE|Q)-[A-Z]?[0-9]* ?계열",l)]
print("범위·계열 축약 =",len(rng),[r[0] for r in rng])
# 계열별 결번
ser=collections.defaultdict(set)
for k in refs:
m=re.match(r"^(Q|RULE|LEAF|FORM|CHECK|STOP-[HCR]|SRC-[LPE])-?([0-9]+)$",k) or re.match(r"^(Q|RULE|LEAF|FORM|CHECK)-([0-9]+)$",k)
if m: ser[m.group(1)].add(int(m.group(2)))
for k in sorted(ser):
v=sorted(ser[k]); gaps=[x for x in range(v[0],v[-1]+1) if x not in ser[k]]
print("계열",k,"범위",v[0],"-",v[-1],"결번",gaps)
# 대괄호 토큰 사전 대조
brs=collections.Counter(re.findall(r"\[[^\[\]\n]{1,30}\]",s))
sec11=s[s.index("## 11."):s.index("## 12.")]
dic=set(re.findall(r"\[[^\[\]\n]{1,30}\]",sec11))
sec7=s[s.index("## 7."):s.index("## 8.")]
dic|=set(re.findall(r"\[[^\[\]\n]{1,30}\]",sec7))
out=sorted(k for k in brs if k not in dic)
print("§7·§11 사전 밖 대괄호 토큰 =",len(out),out)
# §10.2 / §11 변수 정합
sec10=s[s.index("### 10.1"):s.index("## 11.")]
forms={}
for m in re.finditer(r"### (FORM-\d+) — .*?\n(.*?)(?=\n### |\Z)",sec11,re.S):
fid=m.group(1); blk=m.group(2)
dec=re.search(r"^변수: (.*)$",blk,re.M)
decl=set(re.findall(r"\[[^\[\]\n]+\]",dec.group(1))) if dec else set()
fence=re.findall(r"```\n(.*?)```",blk,re.S)
used=set(re.findall(r"\[[^\[\]\n]+\]","".join(fence)))
forms[fid]=(decl,used)
if decl!=used: print(" !! %s 선언%s vs 주문%s"%(fid,sorted(decl-used),sorted(used-decl)))
print("§11 내부 선언 vs 주문 불일치 검사 완료")
for line in sec10.split("\n"):
m=re.match(r"^\| (FORM-\d+) \|",line)
if m and m.group(1) in forms:
cells=[c.strip() for c in line.strip("|").split("|")]
req=set(re.findall(r"\[[^\[\]\n]+\]",cells[2]))
if req!=forms[m.group(1)][1]:
print(" !! §10.2 %s 표%s vs 주문%s"%(m.group(1),sorted(req-forms[m.group(1)][1]),sorted(forms[m.group(1)][1]-req)))
print("§10.2 대조 완료")
skel={"LEAF-01":"FORM-01","LEAF-02":"FORM-02","LEAF-03":"FORM-03","LEAF-04":"FORM-04","LEAF-05":"FORM-05","LEAF-06":"FORM-06"}
for line in sec10.split("\n"):
m=re.match(r"^\| (LEAF-0\d) \|",line)
if m:
cells=[c.strip() for c in line.strip("|").split("|")]
req=set(re.findall(r"\[[^\[\]\n]+\]",cells[5]))
must=set(re.findall(r"FORM-\d+",cells[3]))|{skel[m.group(1)]}
need=set()
for f in must:
if f in forms: need|=forms[f][1]
if not need<=req: print(" !! §10.1 %s 누락%s"%(m.group(1),sorted(need-req)))
if not req<=need: print(" .. §10.1 %s 여분%s"%(m.group(1),sorted(req-need)))
print("§10.1 대조 완료")