fix(archivar): keywords_100 match_keyword → match_keyword_exact in room_map.py (P-108b)

This commit is contained in:
Bernd (Hermes)
2026-08-26 05:00:02 +02:00
parent 275f0673e2
commit f382c8c674
7 changed files with 187 additions and 24 deletions
+5 -5
View File
@@ -31,7 +31,7 @@ from datetime import datetime, timedelta
from pathlib import Path
from typing import Optional, Dict, List
from .keyword_matcher import match_keyword, match_keyword_exact, find_matching_keywords
from .keyword_matcher import match_keyword_exact
logger = logging.getLogger(__name__)
@@ -111,8 +111,8 @@ class RoomEntry:
Returns:
Number of matching keywords (0 if none match).
"""
# 100%-Keywords: morphological matching (stemming, fuzzy)
score_100 = sum(1 for kw in self.keywords_100 if match_keyword(kw, text))
# 100%-Keywords: exact matching (P-108b — konsistent mit booster.py)
score_100 = sum(1 for kw in self.keywords_100 if match_keyword_exact(kw, text))
# Context-Keywords: exact matching only (case-insensitive)
score_context = sum(1 for kw in self.keywords_context if match_keyword_exact(kw, text))
return score_100 + score_context
@@ -303,7 +303,7 @@ class RoomMap:
List of matching keyword strings.
"""
if keyword_type == "100":
return [kw for kw in room.keywords_100 if match_keyword(kw, text)]
return [kw for kw in room.keywords_100 if match_keyword_exact(kw, text)]
else:
return [kw for kw in room.keywords_context if match_keyword_exact(kw, text)]
@@ -485,7 +485,7 @@ class RoomMap:
Used by the router to distinguish 100% keyword matches (auto-route, no Butler)
from context keyword matches (Butler asks, learning opportunity).
"""
return any(match_keyword(kw, text) for kw in room.keywords_100)
return any(match_keyword_exact(kw, text) for kw in room.keywords_100)
def calculate_weighted_score(self, text: str, room: RoomEntry) -> float:
"""