feat: return exception code F1 for unclassified matches
매칭은 있지만 원고 점검 18항목을 정하지 못하면 case_id 를 null 대신 F1(미분류)로 낸다. case_candidates 에 F1 후보를 넣고, 정하지 못한 이유(분류 체계 미로드 / 주 태그 없음 / 판별 대상 항목과 겹치지 않음)를 지점별 reason 으로 남긴다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
03d500d67c
commit
7094d80566
3 files changed
+108
-8
No files matched your search
@@ -136,6 +136,46 @@ def test_case_reason_explains_tags_ties_and_draft_mapping():
|
||||
assert '추정치' in PlagiarismDetector._case_reason(m10, ['reproduction'], hit, tie)
|
||||
|
||||
|
||||
def test_unclassified_reason_differs_by_route():
|
||||
from app.engine.detector import PlagiarismDetector
|
||||
from app.engine.similarity import SimilarityHit
|
||||
tax = load_taxonomy(Path('data/taxonomy'))
|
||||
hit = SimilarityHit(doc_id='d', title='t', score=.4, text_sim=.2, lemma_sim=.2,
|
||||
element_sim={'characters': .1, 'motifs': .1}, evidence=[])
|
||||
no_taxonomy = PlagiarismDetector._unclassified_candidate(None, ['reproduction'], hit)
|
||||
no_primary = PlagiarismDetector._unclassified_candidate(tax, [], hit)
|
||||
no_overlap = PlagiarismDetector._unclassified_candidate(tax, ['integrity'], hit)
|
||||
assert tax.find_cases(['integrity']) == ()
|
||||
for c in (no_taxonomy, no_primary, no_overlap):
|
||||
assert c.case_id == 'F1' and c.title == '미분류'
|
||||
assert c.handling == 'terms_or_report' and c.matched_tags == []
|
||||
assert c.precedent_note and 'text=0.20' in c.reason
|
||||
assert 'TAXONOMY_DIR' in no_taxonomy.reason
|
||||
assert no_primary.reason.startswith('엔진이 주 태그를 내지 못해')
|
||||
assert '동일성유지권' in no_overlap.reason and 'M1·M2·M7·M10·P2' in no_overlap.reason
|
||||
assert len({no_taxonomy.reason, no_primary.reason, no_overlap.reason}) == 3
|
||||
|
||||
|
||||
def test_match_without_primary_tags_gets_f1():
|
||||
"""주 태그가 없어 항목을 못 정한 매칭도 case_id 가 null 이 아니라 F1 이어야 한다."""
|
||||
from app.engine.detector import PlagiarismDetector
|
||||
from app.engine.similarity import SimilarityHit
|
||||
hit = SimilarityHit(doc_id='d', title='t', score=.4, text_sim=.2, lemma_sim=.2,
|
||||
element_sim={'characters': .1, 'motifs': .1}, evidence=[])
|
||||
det = PlagiarismDetector.__new__(PlagiarismDetector)
|
||||
det.taxonomy = load_taxonomy(Path('data/taxonomy'))
|
||||
match = det._to_match(hit, True, None)
|
||||
assert [t.role for t in match.tags] == ['secondary']
|
||||
assert match.case_id == 'F1' and match.case_title == '미분류'
|
||||
assert [c.case_id for c in match.case_candidates] == ['F1']
|
||||
assert match.case_candidates[0].reason.startswith('엔진이 주 태그를 내지 못해')
|
||||
assert match.publication_verdict_status == 'source_pending'
|
||||
assert '분류 미확정(F1)' in det._build_ccl_basis([match])
|
||||
det.taxonomy = None
|
||||
match = det._to_match(hit, True, None)
|
||||
assert match.case_id == 'F1' and 'TAXONOMY_DIR' in match.case_candidates[0].reason
|
||||
|
||||
|
||||
def test_partial_verbatim_copy_gets_case_code(tmp_path):
|
||||
"""원고 일부만 그대로 옮긴 경우 전체 유사도가 중간이라도 분류 코드가 비면 안 된다.
|
||||
|
||||
|
||||
Reference in new issue
Block a user