fix : 매칭 없을 시 판례 미반환 및 판례 판단 조건 조정
This commit is contained in:
1 parent
aaf88d0c1d
commit
c172981c6c
5 files changed
+43
-6
No files matched your search
@@ -132,6 +132,10 @@ async def copyright_review(
|
||||
}
|
||||
if legal.llm_verdict == "likely":
|
||||
legal_status, legal_label = "suspected", "판례에 비추어 저작권 침해 의심"
|
||||
# TODO: 일치가 없는 의심 낮음(no_registered_corpus_match)은 엔진이 판례·요약을 비워 보낸다.
|
||||
# LLM 판단(USE_LLM_LEGAL_JUDGE)이 unlikely 인 경우는 일치가 있는 글이라 판례·요약이 그대로
|
||||
# 남는다. 바이칼 요청("의심 낮음이면 판례·요약 미반환")과 어긋나므로 LLM 판단을 운영에서
|
||||
# 켜기 전에 이 경우도 precedent_ids=[]·summary="" 로 맞춰야 한다.
|
||||
elif (
|
||||
legal.llm_verdict == "unlikely"
|
||||
or legal.status == "no_registered_corpus_match"
|
||||
|
||||
@@ -241,10 +241,15 @@ class LegalRiskEngine:
|
||||
if not rights_verified:
|
||||
missing.append("저작권 귀속·이용허락·인용 요건")
|
||||
|
||||
# 탐지 일치(matches)가 없으면 호출부가 max_similarity=0 을 넘긴다. coverage 는
|
||||
# 일치 판정 전 후보와의 12자 이상 공통 구간이라 흔한 표현만으로도 0을 넘으므로
|
||||
# 등급 기준에 쓰지 않는다. 일치가 없으면 판례·요약도 붙이지 않는다.
|
||||
no_match = max_similarity <= 0
|
||||
if not self.precedents:
|
||||
status, level = "insufficient_precedent_data", None
|
||||
elif max_similarity <= 0 and coverage <= 0:
|
||||
elif no_match:
|
||||
status, level = "no_registered_corpus_match", "low"
|
||||
related = []
|
||||
else:
|
||||
status = "review_required"
|
||||
strong_copy = coverage >= 0.30 or longest_span >= 100
|
||||
@@ -269,7 +274,7 @@ class LegalRiskEngine:
|
||||
precedent_grades=tuple((p.case_id, p.grade) for p in related if p.grade),
|
||||
judgment_summary=_rule_based_summary(status, related),
|
||||
)
|
||||
if self.judge is None or not related or (max_similarity <= 0 and coverage <= 0):
|
||||
if self.judge is None or not related or no_match:
|
||||
return base
|
||||
|
||||
request = LegalJudgeInput(
|
||||
@@ -333,10 +338,7 @@ def _rule_based_summary(status: str, related: list[Precedent]) -> str:
|
||||
if status == "insufficient_precedent_data":
|
||||
return "등록된 판례가 없어 판례에 따른 검토 의견을 제시할 수 없습니다."
|
||||
if status == "no_registered_corpus_match":
|
||||
return (
|
||||
"등록 코퍼스에서 일치 증거가 확인되지 않아 판례 기반 침해 의심을 제시하지 않습니다. "
|
||||
"다만 미매칭은 비침해 확정이 아닙니다."
|
||||
)
|
||||
return ""
|
||||
ids = ", ".join(p.case_id for p in related[:3])
|
||||
suffix = f" 등 {len(related)}건" if len(related) > 3 else ""
|
||||
return f"{ids}{suffix} 판례가 관련 판례로 검색되어 구체적인 사실관계 검토가 필요합니다."
|
||||
|
||||
@@ -57,6 +57,9 @@ curl -X POST https://plagiarism.o2o.kr/v1/plagiarism/detect \
|
||||
> `ai_generation_suspicion.level` 값은 `low`, `medium`, `high`, `unknown`이며,
|
||||
> 화면은 함께 반환되는 한글 `label`을 그대로 표시한다.
|
||||
|
||||
> 일치 구간이 없으면 `legal_judgment.status`는 `low`(침해 의심 낮음)이며,
|
||||
> 이때 `legal_judgment.precedent_ids`는 `[]`, `legal_judgment.summary`는 `""`로 반환한다.
|
||||
|
||||
---
|
||||
|
||||
## 2. 저작권 탭 경량 검사 — `POST /v1/plagiarism/review`
|
||||
|
||||
@@ -65,6 +65,20 @@ def test_copyright_review_returns_only_mobile_tab_fields():
|
||||
assert "score_semantics" not in body
|
||||
|
||||
|
||||
def test_copyright_review_low_omits_precedents_and_summary():
|
||||
"""35자 미만 본문은 일치가 날 수 없으므로 의심 낮음이고 판례·요약이 비어야 한다."""
|
||||
with TestClient(app) as client:
|
||||
resp = client.post(
|
||||
"/v1/plagiarism/review",
|
||||
json={"doc_id": "mobile-low", "text": "창밖으로 보이는 숲은 오늘따라 푸르게 보였다."},
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
legal = resp.json()["legal_judgment"]
|
||||
assert legal["status"] == "low"
|
||||
assert legal["precedent_ids"] == []
|
||||
assert legal["summary"] == ""
|
||||
|
||||
|
||||
def test_batch_flow():
|
||||
with TestClient(app) as client:
|
||||
resp = client.post(
|
||||
|
||||
@@ -43,6 +43,20 @@ def test_risk_requires_missing_facts_and_only_registered_case_ids():
|
||||
assert len(result.missing_factors) == 3
|
||||
|
||||
|
||||
def test_no_detect_match_is_low_without_precedents_or_summary():
|
||||
"""일치(matches)가 없으면 12자 공통 표현으로 coverage 가 있어도 의심 낮음이다."""
|
||||
judge = _FakeJudge()
|
||||
result = LegalRiskEngine([_case()], judge=judge).assess(
|
||||
max_similarity=0.0, coverage=0.2, longest_span=0, legal_tags=[],
|
||||
)
|
||||
assert result.status == "no_registered_corpus_match"
|
||||
assert result.risk_level == "low"
|
||||
assert result.precedent_ids == ()
|
||||
assert result.precedent_grades == ()
|
||||
assert result.judgment_summary == ""
|
||||
assert judge.request is None
|
||||
|
||||
|
||||
def test_repository_seed_is_valid():
|
||||
cases = load_precedents("data/precedents/precedents.jsonl")
|
||||
assert cases
|
||||
|
||||
Reference in new issue
Block a user