diff --git a/app/core/config.py b/app/core/config.py index c3cf7a9..61c8f38 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -33,7 +33,13 @@ class Settings(BaseSettings): persistent_index_dir: str = "./data/runtime/index" use_persistent_index: bool = False persistent_similarity_threshold: float = 0.65 - persistent_min_exact_span: int = 80 + # 9어절 = 공백 포함 35자. 어절 3~9 스윕과 문서쌍 전수 대조로 정한 값이다. + # 4어절 이하는 임의 조합의 99% 이상이 겹쳐 신호가 되지 못하고, 10~15어절 + # 구간부터 겹치는 문서쌍이 고정되어 남는 것이 실제 유사 원고다. + persistent_min_exact_span: int = 35 + # 그대로 겹친 구간을 침해 판정의 필수 조건으로 둘지. false 면 유사도나 + # 커버리지 단독으로도 채택되어 같은 주제의 글에서 오탐이 발생한다. + require_exact_span_evidence: bool = True persistent_min_coverage: float = 0.30 # 상위 N개 후보만 SequenceMatcher 정밀 비교 + union coverage 에 참여시킨다. # 이 값이 곧 요청당 O(질의길이 × 세그먼트길이) 연산의 상한이다 (#3/#5). diff --git a/app/engine/detector.py b/app/engine/detector.py index 678f87d..d953f4a 100644 --- a/app/engine/detector.py +++ b/app/engine/detector.py @@ -305,6 +305,13 @@ class PlagiarismDetector: reasons.append("coverage") if not reasons: continue + # 유사도만 넘고 그대로 겹친 구간이 없는 후보는 채택하지 않는다. + # 같은 주제를 다룬 글은 임베딩 유사도가 함께 오르므로, 유사도 단독 + # 판정은 오탐을 만든다. 실데이터 106건 중 29건이 이 경우였고 검토에서 + # 전부 오탐으로 확인됐다. 반대로 이 조건을 걸어도 새로 놓치는 건은 + # 없었다(미탐지 7,680건 재판정 결과 0건). + if self.settings.require_exact_span_evidence and "exact_span" not in reasons: + continue match = self._to_match( h, opts.return_evidence, lsh_jaccards.get(h.doc_id), self._partial_signal(h.doc_id, elements, query_lemmas),