feat: V8.5+ — Morphologisches Keyword-Matching (Snowball GermanStemmer + Levenshtein Fuzzy + Pre-Compute-Cache)

This commit is contained in:
Bernd (Hermes)
2026-07-19 17:13:46 +02:00
parent 7ba62bd7e4
commit 6eb34e11e3
11 changed files with 1151 additions and 74 deletions
+9 -5
View File
@@ -36,6 +36,8 @@ from .booster import KeywordBooster
from .archivar_state import ArchivarState
from .routing_counter import routing_counter
from .routing_telemetry import routing_telemetry
from .keyword_matcher import match_keyword, match_keyword_exact, find_matching_keywords
from .sentence_markers import (
detect_sentence_marker,
SentenceMarkerResult,
@@ -1710,6 +1712,9 @@ class BidirectionalRouter:
def _extract_matched_keywords(self, text: str, room: RoomEntry) -> List[str]:
"""Extrahiere die Keywords, die zum Match führten.
Uses morphological matching for 100%-keywords and exact matching
for context keywords.
Args:
text: Der Nachrichtentext
room: Der gematchte Raum
@@ -1717,17 +1722,16 @@ class BidirectionalRouter:
Returns:
Liste der gematchten Keywords
"""
text_lower = text.lower()
matched_keywords = []
# Prüfe 100% Evidenz Keywords
# Prüfe 100% Evidenz Keywords (morphologisches Matching)
for kw in room.keywords_100:
if kw.lower() in text_lower and kw not in matched_keywords:
if match_keyword(kw, text) and kw not in matched_keywords:
matched_keywords.append(kw)
# Prüfe kontextabhängige Keywords
# Prüfe kontextabhängige Keywords (exaktes Matching)
for kw in room.keywords_context:
if kw.lower() in text_lower and kw not in matched_keywords:
if match_keyword_exact(kw, text) and kw not in matched_keywords:
matched_keywords.append(kw)
return matched_keywords