fix(documents): g-measure junk 검출 all-caps 과탐 제거 + verdict=coarse 스크린 명시

전부-대문자 휴리스틱이 기술문서 정상 heading(GENERAL REQUIREMENTS/WELDING) 130건 과탐 →
windowed/clean doc 거짓 A_better 강등. 회사-접미사(INC./LLC…)만, cover 영역(앞 4노드)+미stored 게이트.
verdict 는 coarse 스크린(감사용)이고 실집행 결정 = 결정적 partition + 적대 워크플로임을 docstring 박제.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hyungi
2026-06-09 12:58:36 +09:00
parent 321d997123
commit e10ccc9169
+11 -11
View File
@@ -51,14 +51,10 @@ _FENCE_ANY = re.compile(r"(?m)^\s{0,3}(```|~~~)")
def _looks_junk(title: str | None) -> bool:
if not title:
return False
if _JUNK_ORG.search(title):
return True
letters = [c for c in title if c.isalpha()]
if len(letters) >= 6 and sum(1 for c in letters if c.isupper()) / len(letters) >= 0.85:
return True
return False
"""cover/TOC org-이름 junk. ★전부-대문자 휴리스틱은 폐기(2026-06-09): 기술문서의 정상
all-caps heading('GENERAL REQUIREMENTS'/'WELDING')을 130건 과탐해 windowed/clean doc 을 거짓
A_better 강등시켰음. 명시적 회사-접미사만 junk 로 본다(그것도 호출측이 cover 위치+미stored 로 게이트)."""
return bool(title and _JUNK_ORG.search(title))
def _make_engine():
@@ -102,10 +98,14 @@ async def _measure_doc(session, doc_id):
res["hash_stable_99"] = False
stored_titles = {s["section_title"] for s in stored if s["section_title"]}
res["junk_b"] = any(_looks_junk(n.section_title) and n.section_title not in stored_titles for n in nodes)
# junk = cover 영역(앞쪽 노드)의 신규 org-이름 heading 만 (positional). 본문 전반의 정상 heading 무관.
res["junk_b"] = any(_looks_junk(n.section_title) and n.section_title not in stored_titles for n in nodes[:4])
# verdict 휴리스틱 (high-recall junk 보호 + absent-structure → A_better).
# MEASURE2 가 canonical 분포를 이미 박제 — 이 verdict 는 재현/감사용. 애매(notes:ambiguous)는 PASS 미차단.
# verdict 휴리스틱 = coarse 스크린(재현/감사용). ★2026-06-09 실집행의 authoritative 결정은 이게 아니라:
# (a) 결정적 partition: pure_benefit(n_a<=2)/comparable(0.85<=ratio<=2) = 자동 INCLUDE,
# overseg(ratio>2)/absent(ratio<0.85) = 적대 검증 대상.
# (b) 적대 워크플로(judge+refute)가 위험 후보를 stored vs build 제목으로 per-doc INCLUDE/EXCLUDE 확정.
# 이 휴리스틱 단독으로 destructive re-decompose 리스트를 만들지 말 것(junk 과탐·threshold 과적합 이력).
# ★ apples-to-apples: 양쪽 모두 JUMP-TARGET 수로 비교(stored leaf 전수 X — window-child 가 n_a 를 부풀려
# windowed doc 을 거짓 A_better 로 떨구는 bias 제거). stored jump-target = (비-window leaf OR %_split) + 제목.
def _stored_is_jt(s):