Keep confirmed detect cues from opening a second type-conflict review.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
011cc9dd81
commit
0277039b07
7 files changed
+33
-7
No files matched your search
@@ -16,6 +16,7 @@ from detect_learning import canonicalize_detect_mode, decision_for_mention
|
||||
from detect_pipeline import (
|
||||
MentionSpan,
|
||||
compact_diff_counters,
|
||||
compare_mentions,
|
||||
map_entity_type,
|
||||
protects,
|
||||
same_mention,
|
||||
@@ -38,6 +39,16 @@ def main() -> None:
|
||||
expect(protects("PERSON") and not protects("FOOD"), "PERSON protects, FOOD does not")
|
||||
expect(types_equivalent("PERSON", "PLACE"), "similar protectable types are equivalent")
|
||||
expect(not types_equivalent("FOOD", "PERSON"), "FOOD versus PERSON is never equivalent")
|
||||
guessed = MentionSpan("Sushi", 20, 25, "PERSON", "identity", "candidate", False, "aß")
|
||||
teacher_food = MentionSpan("Sushi", 20, 25, "FOOD", "not_identity", "teacher", False, "aß")
|
||||
offered, offered_counters = compare_mentions("p", "Ich aß Sushi.", [guessed], [teacher_food])
|
||||
expect(offered_counters["diff_type_conflict"] == 1, "unconfirmed FOOD versus PERSON is counted")
|
||||
expect(any(item.get("reason") == "type_conflict" for item in offered), "unconfirmed type conflict is offered")
|
||||
confirmed = MentionSpan("Sushi", 20, 25, "FOOD", "not_identity", "cue", True, "rohan")
|
||||
teacher_person = MentionSpan("Sushi", 20, 25, "PERSON", "identity", "teacher", False, "rohan")
|
||||
kept, kept_counters = compare_mentions("p", "Rohan Sushi essen", [confirmed], [teacher_person])
|
||||
expect(kept_counters["diff_type_conflict"] == 1, "confirmed cue still counts FOOD versus PERSON")
|
||||
expect(not kept, "confirmed cue is not re-asked on type conflict")
|
||||
inner = MentionSpan("Sushi", 20, 25, "PERSON", "identity", "cue", True, "frau")
|
||||
outer = MentionSpan("Frau Sushi", 15, 25, "PERSON", "identity", "teacher", False, "frau")
|
||||
expect(same_mention(inner, outer), "contained span is the same mention")
|
||||
|
||||
Reference in new issue
Block a user