fix(archivar): keywords_100 match_keyword → match_keyword_exact in room_map.py (P-108b)
This commit is contained in:
@@ -389,10 +389,14 @@ class TestRoomMapMorphologicalMatching:
|
||||
])
|
||||
|
||||
def test_find_room_plural_keyword(self, room_map):
|
||||
"""'Homelabs' should match #LAN-Dokumentation via 'homelab' keyword."""
|
||||
"""'Homelabs' (Plural) matcht 'homelab' NICHT mehr — P-108b exact matching.
|
||||
|
||||
Plural-Formen müssen als eigene keywords_100-Variante eingetragen werden
|
||||
(P-028/P-108b bewusster Trade-off).
|
||||
"""
|
||||
result = room_map.find_room_by_keywords("Homelabs konfigurieren")
|
||||
assert result is not None
|
||||
assert result.room_id == "r_lan"
|
||||
# Plural ist kein exact-Match mehr → kein 100%-Routing auf r_lan.
|
||||
assert result is None or result.room_id != "r_lan"
|
||||
|
||||
def test_find_room_dativ_keyword(self, room_map):
|
||||
"""'dem Homelab' should match via 'homelab' keyword."""
|
||||
@@ -401,10 +405,9 @@ class TestRoomMapMorphologicalMatching:
|
||||
assert result.room_id == "r_lan"
|
||||
|
||||
def test_find_room_plural_dokumentation(self, room_map):
|
||||
"""'Dokumentationen' should match via 'dokumentation' keyword."""
|
||||
"""'Dokumentationen' matcht 'dokumentation' NICHT mehr — P-108b exact matching."""
|
||||
result = room_map.find_room_by_keywords("Dokumentationen aktualisieren")
|
||||
assert result is not None
|
||||
assert result.room_id == "r_lan"
|
||||
assert result is None or result.room_id != "r_lan"
|
||||
|
||||
def test_find_room_compound_ddp(self, room_map):
|
||||
"""'DDP-WebSocket' should match #RC-Plugin via 'ddp' keyword."""
|
||||
@@ -413,12 +416,15 @@ class TestRoomMapMorphologicalMatching:
|
||||
assert result.room_id == "r_rc"
|
||||
|
||||
def test_is_100_percent_match_plural(self, room_map):
|
||||
"""is_100_percent_match should use morphological matching."""
|
||||
"""is_100_percent_match nutzt exact matching — Plural matcht NICHT mehr (P-108b)."""
|
||||
lan_room = room_map.get_room_by_id("r_lan")
|
||||
assert lan_room is not None
|
||||
assert room_map.is_100_percent_match("Homelabs", lan_room) is True
|
||||
assert room_map.is_100_percent_match("Dokumentationen", lan_room) is True
|
||||
assert room_map.is_100_percent_match("Netzwerke", lan_room) is True
|
||||
# Singular (exact) bleibt True
|
||||
assert room_map.is_100_percent_match("Homelab", lan_room) is True
|
||||
# Plural/Stemming-Formen sind kein 100%-Match mehr (P-028/P-108b)
|
||||
assert room_map.is_100_percent_match("Homelabs", lan_room) is False
|
||||
assert room_map.is_100_percent_match("Dokumentationen", lan_room) is False
|
||||
assert room_map.is_100_percent_match("Netzwerke", lan_room) is False
|
||||
|
||||
def test_is_100_percent_match_false_positive_prevention(self, room_map):
|
||||
"""is_100_percent_match should NOT match semantically different words."""
|
||||
@@ -463,10 +469,10 @@ class TestRoomEntryMatchScore:
|
||||
keywords_100=["homelab", "dokumentation"],
|
||||
keywords_context=["docker"],
|
||||
)
|
||||
# 'Homelabs' → match 'homelab' (1), 'Dokumentationen' → match 'dokumentation' (1)
|
||||
# 'Docker' → match 'docker' (1) = total 3
|
||||
# P-108b exact matching: 'Homelabs'/'Dokumentationen' sind KEINE
|
||||
# 100%-Matches mehr. Nur 'Docker' (context, exact) matcht → 1.
|
||||
score = entry.match_score("Homelabs und Dokumentationen mit Docker")
|
||||
assert score == 3
|
||||
assert score == 1
|
||||
|
||||
def test_match_score_no_false_positive(self):
|
||||
entry = RoomEntry(
|
||||
|
||||
Reference in New Issue
Block a user