feat: replace 39 infringement cases with v3.0 18-item manuscript checklist
- data/taxonomy/cases_v3.0.json: 아카이빙DB v3.0 「2.원고점검체계18」 + 부록1-A 대표판례. 항목↔태그 매핑은 원문 표가 없어 tag_basis(명시/추정)로 구분 (추정 7항목은 컴북스 확인 대기) - 분류 후보를 엔진 판별 대상(M1·M2·M7·M10·P2)으로 한정 - admin detect 응답 case_candidates 에 matched_tags·reason·decision_steps·author_request 추가 (author 응답에서는 기존대로 제외) - /v1/taxonomy 에 항목별 판단 기준·판정 단계·문면·태그 근거 노출 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7d985b4ec3
commit
12bb82a015
10 files changed
+757
-1006
No files matched your search
+30
-6
@@ -53,7 +53,7 @@ from app.engine.similarity import (
|
||||
build_text_backend,
|
||||
)
|
||||
from app.engine.structural import extract_lemmas
|
||||
from app.engine.taxonomy import Taxonomy, load_taxonomy
|
||||
from app.engine.taxonomy import CaseDef, Taxonomy, load_taxonomy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -607,8 +607,8 @@ class PlagiarismDetector:
|
||||
) -> MatchResult:
|
||||
legacy_type = _classify_legacy(hit)
|
||||
tags = self._assign_tags(hit, legacy_type)
|
||||
cases = (self.taxonomy.find_cases([t.tag for t in tags if t.role == "primary"])
|
||||
if self.taxonomy else ())
|
||||
primary_tags = [t.tag for t in tags if t.role == "primary"]
|
||||
cases = self.taxonomy.find_cases(primary_tags) if self.taxonomy else ()
|
||||
candidates = [
|
||||
CaseCandidate(
|
||||
case_id=c.case_id,
|
||||
@@ -620,6 +620,10 @@ class PlagiarismDetector:
|
||||
p.case_id for p in c.representative_precedents if not p.in_runtime_corpus
|
||||
],
|
||||
precedent_note=c.representative_precedent_note,
|
||||
matched_tags=[t for t in primary_tags if t in c.primary_tags],
|
||||
reason=self._case_reason(c, primary_tags, hit, cases),
|
||||
decision_steps=c.decision_steps,
|
||||
author_request=c.author_request,
|
||||
)
|
||||
for c in cases
|
||||
]
|
||||
@@ -647,6 +651,26 @@ class PlagiarismDetector:
|
||||
partial_signal=partial,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _case_reason(case: CaseDef, primary_tags: list[str], hit: SimilarityHit,
|
||||
tie: tuple[CaseDef, ...]) -> str:
|
||||
"""관리자 콘솔에 표시할 분류 사유. 엔진 신호 → 겹친 태그 → 항목 판단 기준 순."""
|
||||
matched = "·".join(TAG_LABEL_KO[t] for t in primary_tags if t in case.primary_tags)
|
||||
signal = (f"text={hit.text_sim:.2f} / lemma={hit.lemma_sim:.2f} / "
|
||||
f"char={hit.element_sim.get('characters', 0.0):.2f} / "
|
||||
f"motif={hit.element_sim.get('motifs', 0.0):.2f}")
|
||||
reason = (f"엔진 주 태그 {matched}이(가) {case.case_id}({case.title})의 태그와 "
|
||||
f"일치합니다 [{signal}].")
|
||||
if len(tie) > 1:
|
||||
ids = ", ".join(c.case_id for c in tie)
|
||||
reason += (f" 텍스트만으로는 {ids} 중 하나로 좁혀지지 않으므로 작성자 관계"
|
||||
"(대필·동일인·이중 등록)와 원본 종류를 확인해 확정해야 합니다.")
|
||||
if case.check_point:
|
||||
reason += f" 판단할 것: {case.check_point}"
|
||||
if case.tag_basis == "추정":
|
||||
reason += " (이 항목의 태그 매핑은 추정치로, 컴북스 확인 전입니다.)"
|
||||
return reason
|
||||
|
||||
def _assign_tags(self, hit: SimilarityHit, legacy: InfringementType) -> list[InfringementTag]:
|
||||
"""삼중 유사도 분포 → 10종 법령 태그(주/보조) 매핑.
|
||||
|
||||
@@ -731,10 +755,10 @@ class PlagiarismDetector:
|
||||
tag_summary = ", ".join(primary_labels) if primary_labels else "확인 필요"
|
||||
if len(top.case_candidates) > 1:
|
||||
ids = ", ".join(c.case_id for c in top.case_candidates)
|
||||
case_part = (f" 추정 케이스 후보 {ids} — 태그만으로는 구별되지 않으므로 "
|
||||
f"베껴온 원본의 종류를 확인해 확정해야 합니다.")
|
||||
case_part = (f" 추정 분류 후보 {ids} — 태그만으로는 구별되지 않으므로 "
|
||||
f"작성자 관계와 원본 종류를 확인해 확정해야 합니다.")
|
||||
elif top.case_id:
|
||||
case_part = f" 추정 케이스 {top.case_id} ({top.case_title})."
|
||||
case_part = f" 추정 분류 {top.case_id} ({top.case_title})."
|
||||
else:
|
||||
case_part = ""
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user