feat(archivar): RoutingWiderspruchDetector — textbasierte Widerspruch-Erkennung
NEUES MODUL: plugin/archivar/feedback_detector.py - RoutingWiderspruchDetector mit 4 Regex-Gruppen (Hauptmuster, Umrouting, Verneinung, Befehle) - ContradictionResult dataclass: has_contradiction, contradiction_type, confidence, target_room, rejected_room, matched_pattern - Edge Cases: 'nicht in X, sondern in Y' → X negativ, Y als Ziel - Kein LLM-Fallback (nur Regex in v1) EINHAENGUNG adapter_integration.py: - ArchivarMessageHandler.__init__(): self._feedback_detector - detect_routing_contradiction(text, origin_room_id) → ContradictionResult|None - Bei Treffer: update_keyword_weight(feedback_type='never') - _resolve_room_name_to_id() für Raum-Name → room_id Auflösung EINHAENGUNG adapter.py: - _process_incoming(): VOR classify_and_route() → contradiction-Check - Bei Treffer: Decision überschreiben (stay_in_room=True) - [WIDERSPRUCH]-Präfix — Nachricht NICHT schlucken, normal an Agent - NUR wenn KEIN Button-Feedback aktiv (kein pending move-request) Tests: 57/58 passed (1 pre-existing env-var failure unverändert)
This commit is contained in:
@@ -24,6 +24,7 @@ import urllib.request
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from .archivar.adapter_integration import ArchivarMessageHandler
|
from .archivar.adapter_integration import ArchivarMessageHandler
|
||||||
|
from .archivar.router import RoutingDecision
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
@@ -809,6 +810,32 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
logger.debug("[rocketchat] Room %s is sticky — Archivar bypassed", room_id[:8])
|
logger.debug("[rocketchat] Room %s is sticky — Archivar bypassed", room_id[:8])
|
||||||
elif room_type == "d" and is_auftrag:
|
elif room_type == "d" and is_auftrag:
|
||||||
logger.debug("[rocketchat] DM-Auftrag von %s — kein Routing", username)
|
logger.debug("[rocketchat] DM-Auftrag von %s — kein Routing", username)
|
||||||
|
else:
|
||||||
|
# ── RoutingWiderspruchDetector: VOR classify_and_route() ──
|
||||||
|
# NUR wenn KEIN Button-Feedback aktiv (kein pending move-request).
|
||||||
|
# Button = geregelter Standard, Text = Fall ohne Button.
|
||||||
|
contradiction = self.archivar.detect_routing_contradiction(
|
||||||
|
text, origin_room_id=room_id
|
||||||
|
)
|
||||||
|
if contradiction:
|
||||||
|
logger.info(
|
||||||
|
"[rocketchat] Routing-Widerspruch in %s: type=%s conf=%.2f — "
|
||||||
|
"stay_in_room + [WIDERSPRUCH]-Präfix",
|
||||||
|
room_id[:8],
|
||||||
|
contradiction.contradiction_type,
|
||||||
|
contradiction.confidence,
|
||||||
|
)
|
||||||
|
# Decision überschreiben: stay_in_room
|
||||||
|
decision = RoutingDecision(
|
||||||
|
category="direct_question",
|
||||||
|
target_room="",
|
||||||
|
confidence=contradiction.confidence,
|
||||||
|
stay_in_room=True,
|
||||||
|
)
|
||||||
|
category = decision.category
|
||||||
|
# [WIDERSPRUCH]-Präfix setzen — Nachricht NICHT schlucken
|
||||||
|
text = f"[WIDERSPRUCH] {text}"
|
||||||
|
# Kein Routing, keine Move-Requests — direkt zum Agenten
|
||||||
else:
|
else:
|
||||||
decision = await self.archivar.classify_and_route(text, origin_room_id=room_id)
|
decision = await self.archivar.classify_and_route(text, origin_room_id=room_id)
|
||||||
if decision and decision.category:
|
if decision and decision.category:
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ try:
|
|||||||
from room_map import RoomMap, RoomMapValidationError
|
from room_map import RoomMap, RoomMapValidationError
|
||||||
from router import BidirectionalRouter, RoutingDecision
|
from router import BidirectionalRouter, RoutingDecision
|
||||||
from archivar_state import ArchivarState
|
from archivar_state import ArchivarState
|
||||||
|
from feedback_detector import RoutingWiderspruchDetector, ContradictionResult
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Fallback for testing or different import structure
|
# Fallback for testing or different import structure
|
||||||
from .classifier import (
|
from .classifier import (
|
||||||
@@ -90,6 +91,7 @@ except ImportError:
|
|||||||
from .room_index import RoomIndexManager
|
from .room_index import RoomIndexManager
|
||||||
from .booster import KeywordBooster
|
from .booster import KeywordBooster
|
||||||
from .seed_data import SEED_DATA
|
from .seed_data import SEED_DATA
|
||||||
|
from .feedback_detector import RoutingWiderspruchDetector, ContradictionResult
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
@@ -212,6 +214,9 @@ class ArchivarMessageHandler:
|
|||||||
# Speichere die zuletzt gerouteten Nachrichten für das Feedback
|
# Speichere die zuletzt gerouteten Nachrichten für das Feedback
|
||||||
self._routed_messages: Dict[str, Dict[str, Any]] = {} # message_id -> {text, source_room, target_room, keywords}
|
self._routed_messages: Dict[str, Dict[str, Any]] = {} # message_id -> {text, source_room, target_room, keywords}
|
||||||
|
|
||||||
|
# ── RoutingWiderspruchDetector ──────────────────────────────────
|
||||||
|
self._feedback_detector = RoutingWiderspruchDetector()
|
||||||
|
|
||||||
# ── RoomMap Loading ─────────────────────────────────────────────────
|
# ── RoomMap Loading ─────────────────────────────────────────────────
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -426,6 +431,103 @@ class ArchivarMessageHandler:
|
|||||||
|
|
||||||
return decision
|
return decision
|
||||||
|
|
||||||
|
def detect_routing_contradiction(
|
||||||
|
self, text: str, origin_room_id: str = ""
|
||||||
|
) -> Optional[ContradictionResult]:
|
||||||
|
"""Erkenne einen textuellen Routing-Widerspruch und aktualisiere Gewichte.
|
||||||
|
|
||||||
|
Wird vom Adapter VOR ``classify_and_route()`` aufgerufen, wenn KEIN
|
||||||
|
Button-Feedback (kein pending move-request) aktiv ist.
|
||||||
|
|
||||||
|
Bei einem Treffer:
|
||||||
|
- Keyword-Gewicht wird via ``update_keyword_weight(feedback_type='never')``
|
||||||
|
negativ aktualisiert (rejected_room oder target_room).
|
||||||
|
- Eine ``RoutingDecision`` mit ``stay_in_room=True`` wird zurückgegeben.
|
||||||
|
- Die Nachricht wird NICHT geschluckt — sie erhält ein [WIDERSPRUCH]-Präfix
|
||||||
|
und wird normal an den Agenten weitergeleitet.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
text: Der Nachrichtentext.
|
||||||
|
origin_room_id: Rocket.Chat Raum-ID des Ursprungsraums.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ContradictionResult wenn ein Widerspruch erkannt wurde, sonst None.
|
||||||
|
"""
|
||||||
|
result = self._feedback_detector.detect(text)
|
||||||
|
if result is None or not result.has_contradiction:
|
||||||
|
return None
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"Routing-Widerspruch erkannt: type=%s confidence=%.2f "
|
||||||
|
"target=%s rejected=%s pattern=%s",
|
||||||
|
result.contradiction_type,
|
||||||
|
result.confidence,
|
||||||
|
result.target_room or "—",
|
||||||
|
result.rejected_room or "—",
|
||||||
|
result.matched_pattern,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Keyword-Gewicht negativ aktualisieren ───────────────────────
|
||||||
|
# Bei routing_rejection: rejected_room negativ gewichten
|
||||||
|
# Bei reroute_request: target_room (das neue Ziel) NICHT negativ —
|
||||||
|
# stattdessen den rejected_room (wenn vorhanden) negativ gewichten.
|
||||||
|
room_to_penalize: Optional[str] = None
|
||||||
|
|
||||||
|
if result.contradiction_type == "routing_rejection":
|
||||||
|
room_to_penalize = result.rejected_room
|
||||||
|
elif result.contradiction_type == "reroute_request":
|
||||||
|
# „nicht in X, sondern in Y": X negativ gewichten
|
||||||
|
room_to_penalize = result.rejected_room
|
||||||
|
|
||||||
|
if room_to_penalize:
|
||||||
|
# Versuche, den Raum-Namen in eine room_id aufzulösen
|
||||||
|
room_id = self._resolve_room_name_to_id(room_to_penalize)
|
||||||
|
if room_id:
|
||||||
|
# Verwende den Raum-Namen als Keyword für die Gewichtung
|
||||||
|
self._state.update_keyword_weight(
|
||||||
|
keyword=room_to_penalize,
|
||||||
|
room_id=room_id,
|
||||||
|
feedback_type="never",
|
||||||
|
)
|
||||||
|
logger.info(
|
||||||
|
"Keyword-Gewicht für '%s' in Raum %s auf 0.0 gesetzt (never)",
|
||||||
|
room_to_penalize, room_id[:8],
|
||||||
|
)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _resolve_room_name_to_id(self, room_name: str) -> Optional[str]:
|
||||||
|
"""Löse einen Raum-Namen (mit oder ohne #) in eine room_id auf.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
room_name: Raum-Name wie 'Dokumentation', '#Support', 'Projekt-X'.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
room_id wenn gefunden, sonst None.
|
||||||
|
"""
|
||||||
|
# Normalisiere: entferne führendes #
|
||||||
|
normalized = room_name.lstrip("#").lower()
|
||||||
|
|
||||||
|
for room_id, entry in self._room_map.rooms.items():
|
||||||
|
entry_name = entry.name.lstrip("#").lower()
|
||||||
|
if entry_name == normalized:
|
||||||
|
return room_id
|
||||||
|
|
||||||
|
# Auch in _subscribed_room_ids_cache suchen (falls Map nicht alle Räume hat)
|
||||||
|
# Aber wir haben keine Namen für subscribed rooms ohne Map-Eintrag.
|
||||||
|
# Fallback: partial match
|
||||||
|
for room_id, entry in self._room_map.rooms.items():
|
||||||
|
entry_name = entry.name.lstrip("#").lower()
|
||||||
|
if normalized in entry_name or entry_name in normalized:
|
||||||
|
logger.debug(
|
||||||
|
"Partial room name match: '%s' → '%s' (%s)",
|
||||||
|
room_name, entry.name, room_id[:8],
|
||||||
|
)
|
||||||
|
return room_id
|
||||||
|
|
||||||
|
logger.debug("Could not resolve room name '%s' to a room_id", room_name)
|
||||||
|
return None
|
||||||
|
|
||||||
async def _send_clarify(self, room_id: str, text: str, decision: RoutingDecision) -> bool:
|
async def _send_clarify(self, room_id: str, text: str, decision: RoutingDecision) -> bool:
|
||||||
"""Sende eine Klärungsanfrage mit nativen Rocket.Chat Action-Buttons.
|
"""Sende eine Klärungsanfrage mit nativen Rocket.Chat Action-Buttons.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,232 @@
|
|||||||
|
"""
|
||||||
|
RoutingWiderspruchDetector — textbasierte Widerspruch-Erkennung für den Archivar.
|
||||||
|
|
||||||
|
Erkennt textuelle Widersprüche gegen Routing-Entscheidungen („Nein, das passt
|
||||||
|
nicht in Raum X") und behandelt sie wie Button-Antworten. Wird NUR aktiv, wenn
|
||||||
|
KEIN Button-Feedback (kein pending move-request) aktiv ist.
|
||||||
|
|
||||||
|
Button = geregelter Standard, Text = Fall ohne Button.
|
||||||
|
|
||||||
|
Usage::
|
||||||
|
|
||||||
|
detector = RoutingWiderspruchDetector()
|
||||||
|
result = detector.detect("Nein, das passt nicht in #Dokumentation")
|
||||||
|
if result and result.has_contradiction:
|
||||||
|
# result.contradiction_type → 'routing_rejection' | 'reroute_request'
|
||||||
|
# result.target_room → 'Dokumentation' (optional, für Umrouting)
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import re
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from typing import Optional, List
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ContradictionResult:
|
||||||
|
"""Ergebnis der Widerspruch-Erkennung."""
|
||||||
|
|
||||||
|
has_contradiction: bool
|
||||||
|
"""True wenn ein Widerspruch erkannt wurde."""
|
||||||
|
|
||||||
|
contradiction_type: str = ""
|
||||||
|
"""Typ des Widerspruchs: 'routing_rejection' | 'reroute_request'."""
|
||||||
|
|
||||||
|
confidence: float = 0.0
|
||||||
|
"""Konfidenz der Erkennung (0.0–1.0)."""
|
||||||
|
|
||||||
|
target_room: Optional[str] = None
|
||||||
|
"""Zielraum-Name bei Umrouting-Wünschen, sonst None."""
|
||||||
|
|
||||||
|
matched_pattern: str = ""
|
||||||
|
"""Name des Regex-Musters, das getroffen hat (für Debugging)."""
|
||||||
|
|
||||||
|
rejected_room: Optional[str] = None
|
||||||
|
"""Raum-Name, der abgelehnt wurde (bei routing_rejection mit Raumnennung)."""
|
||||||
|
|
||||||
|
|
||||||
|
class RoutingWiderspruchDetector:
|
||||||
|
"""Erkennt textuelle Widersprüche gegen Routing-Entscheidungen via Regex.
|
||||||
|
|
||||||
|
Vier Regex-Gruppen, absteigend nach Spezifität:
|
||||||
|
|
||||||
|
a) **Hauptmuster** — „Nein, das passt nicht in X"
|
||||||
|
Erkennt explizite Ablehnung mit Zielraum-Nennung.
|
||||||
|
→ contradiction_type='routing_rejection', rejected_room=X
|
||||||
|
|
||||||
|
b) **Umrouting** — „Das sollte eigentlich in Y"
|
||||||
|
Erkennt Umrouting-Wunsch mit alternativem Zielraum.
|
||||||
|
→ contradiction_type='reroute_request', target_room=Y
|
||||||
|
|
||||||
|
c) **Verneinung** — „Bleib hier", „Nicht verschieben"
|
||||||
|
Erkennt generelle Routing-Ablehnung ohne Raumnennung.
|
||||||
|
→ contradiction_type='routing_rejection'
|
||||||
|
|
||||||
|
d) **Befehle** — „Falscher Raum", „Stop", „Nicht routen"
|
||||||
|
Erkennt imperative Routing-Ablehnung.
|
||||||
|
→ contradiction_type='routing_rejection'
|
||||||
|
|
||||||
|
Edge Cases:
|
||||||
|
- „nicht in X, sondern in Y": X negativ gewichten, Y als Ziel setzen
|
||||||
|
→ contradiction_type='reroute_request', target_room=Y, rejected_room=X
|
||||||
|
- Mehrdeutig: None zurückgeben (stay_in_room Default)
|
||||||
|
- Kein vorheriges Routing: stay_in_room (Default)
|
||||||
|
"""
|
||||||
|
|
||||||
|
# ── Regex-Gruppen (kompiliert) ──────────────────────────────────────
|
||||||
|
|
||||||
|
# a) Hauptmuster: explizite Ablehnung mit Raumnennung
|
||||||
|
# „Nein, das passt nicht in #Dokumentation"
|
||||||
|
# „Stop, die Nachricht gehört nicht nach Support"
|
||||||
|
# „Falsch, das soll nie in Projekt-X landen"
|
||||||
|
HAUPTMUSTER: re.Pattern = re.compile(
|
||||||
|
r"(?i)(nein|stop|nicht|falsch)(?:,|\s)(?:das|die)?.*?"
|
||||||
|
r"(?:passt|gehört|gehoert|soll|landet).*?"
|
||||||
|
r"(?:nicht|nie|keinesfalls|auf\s+keinen\s+fall).*?"
|
||||||
|
r"(?:in|nach|zu)\s+(\w+)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# b) Umrouting: alternativer Zielraum gewünscht
|
||||||
|
# „Das sollte eigentlich in #Support"
|
||||||
|
# „Diese Nachricht sollte besser nach Projekt-Y"
|
||||||
|
# „Das gehört eher in #Dokumentation"
|
||||||
|
UMRUTING: re.Pattern = re.compile(
|
||||||
|
r"(?i)(?:das|diese\s+nachricht|die|der\s+auftrag).*?"
|
||||||
|
r"(?:sollte|besser|eigentlich|eher|richtigerweise|korrekterweise).*?"
|
||||||
|
r"(?:in|nach|zu)\s+(\w+)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# b2) „nicht in X, sondern in Y" — Sonderfall: Ablehnung + Umrouting
|
||||||
|
# Extrahiert BEIDE Räume: X = rejected, Y = target
|
||||||
|
NICHT_IN_X_SONDERN_IN_Y: re.Pattern = re.compile(
|
||||||
|
r"(?i)(?:nicht|nie|keinesfalls)\s+(?:in|nach|zu)\s+(\w+)"
|
||||||
|
r".*?"
|
||||||
|
r"(?:sondern|sondern\s+eher|sondern\s+besser)\s+(?:in|nach|zu)\s+(\w+)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# c) Verneinung: generelle Ablehnung ohne Raumnennung
|
||||||
|
# „Bleib hier", „Bleibe da", „Nicht wechseln", „Nicht routen"
|
||||||
|
# „Nicht verschieben", „Lass es hier"
|
||||||
|
VERNEINUNG: re.Pattern = re.compile(
|
||||||
|
r"(?i)(?:bleib|bleibe|lass\s+es|behalt|behalte)"
|
||||||
|
r"\s+(?:hier|da|im\s+raum|in\s+diesem\s+raum)"
|
||||||
|
r"|"
|
||||||
|
r"(?:nicht|nie|keinesfalls)\s+"
|
||||||
|
r"(?:wechseln|routen|verschieben|umleiten|bewegen|kopieren)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# d) Befehle: imperative Kurzformen
|
||||||
|
# „Falscher Raum", „Stop", „Nicht routen", „Nicht verschieben"
|
||||||
|
BEFEHLE: re.Pattern = re.compile(
|
||||||
|
r"^\s*(?:falscher\s+raum|stop|halt|abbruch)\s*[.!]*\s*$"
|
||||||
|
r"|"
|
||||||
|
r"^\s*(?:nicht|nie)\s+(?:routen|verschieben|umleiten|bewegen)\s*[.!]*\s*$",
|
||||||
|
re.IGNORECASE,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── Confidence-Werte pro Mustertyp ──────────────────────────────────
|
||||||
|
|
||||||
|
CONFIDENCE_MAP = {
|
||||||
|
"hauptmuster": 0.90,
|
||||||
|
"umruting": 0.88,
|
||||||
|
"nicht_in_x_sondern_in_y": 0.92,
|
||||||
|
"verneinung": 0.85,
|
||||||
|
"befehle": 0.82,
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Public API ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def detect(self, text: str) -> Optional[ContradictionResult]:
|
||||||
|
"""Erkenne einen Routing-Widerspruch im Text.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
text: Der Nachrichtentext (kann Prefixe wie [WIDERSPRUCH] enthalten).
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ContradictionResult wenn ein Widerspruch erkannt wurde, sonst None.
|
||||||
|
"""
|
||||||
|
if not text or not text.strip():
|
||||||
|
return None
|
||||||
|
|
||||||
|
text = text.strip()
|
||||||
|
|
||||||
|
# ── b2) Sonderfall: „nicht in X, sondern in Y" ──────────────────
|
||||||
|
# Dieser MUSS vor dem Hauptmuster geprüft werden, weil das Hauptmuster
|
||||||
|
# nur „nicht in X" matchen würde und Y verloren ginge.
|
||||||
|
m_sondern = self.NICHT_IN_X_SONDERN_IN_Y.search(text)
|
||||||
|
if m_sondern:
|
||||||
|
rejected = m_sondern.group(1)
|
||||||
|
target = m_sondern.group(2)
|
||||||
|
logger.debug(
|
||||||
|
"Widerspruch (nicht_in_x_sondern_in_y): rejected=%s target=%s",
|
||||||
|
rejected, target,
|
||||||
|
)
|
||||||
|
return ContradictionResult(
|
||||||
|
has_contradiction=True,
|
||||||
|
contradiction_type="reroute_request",
|
||||||
|
confidence=self.CONFIDENCE_MAP["nicht_in_x_sondern_in_y"],
|
||||||
|
target_room=target,
|
||||||
|
rejected_room=rejected,
|
||||||
|
matched_pattern="nicht_in_x_sondern_in_y",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── a) Hauptmuster ──────────────────────────────────────────────
|
||||||
|
m_haupt = self.HAUPTMUSTER.search(text)
|
||||||
|
if m_haupt:
|
||||||
|
negation_word = m_haupt.group(1).lower()
|
||||||
|
room_name = m_haupt.group(2)
|
||||||
|
logger.debug(
|
||||||
|
"Widerspruch (hauptmuster): negation=%s room=%s",
|
||||||
|
negation_word, room_name,
|
||||||
|
)
|
||||||
|
return ContradictionResult(
|
||||||
|
has_contradiction=True,
|
||||||
|
contradiction_type="routing_rejection",
|
||||||
|
confidence=self.CONFIDENCE_MAP["hauptmuster"],
|
||||||
|
rejected_room=room_name,
|
||||||
|
matched_pattern="hauptmuster",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── b) Umrouting ────────────────────────────────────────────────
|
||||||
|
m_um = self.UMRUTING.search(text)
|
||||||
|
if m_um:
|
||||||
|
target_room = m_um.group(1)
|
||||||
|
logger.debug(
|
||||||
|
"Widerspruch (umruting): target=%s", target_room,
|
||||||
|
)
|
||||||
|
return ContradictionResult(
|
||||||
|
has_contradiction=True,
|
||||||
|
contradiction_type="reroute_request",
|
||||||
|
confidence=self.CONFIDENCE_MAP["umruting"],
|
||||||
|
target_room=target_room,
|
||||||
|
matched_pattern="umruting",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── c) Verneinung ───────────────────────────────────────────────
|
||||||
|
m_verneinung = self.VERNEINUNG.search(text)
|
||||||
|
if m_verneinung:
|
||||||
|
logger.debug("Widerspruch (verneinung): matched")
|
||||||
|
return ContradictionResult(
|
||||||
|
has_contradiction=True,
|
||||||
|
contradiction_type="routing_rejection",
|
||||||
|
confidence=self.CONFIDENCE_MAP["verneinung"],
|
||||||
|
matched_pattern="verneinung",
|
||||||
|
)
|
||||||
|
|
||||||
|
# ── d) Befehle ──────────────────────────────────────────────────
|
||||||
|
m_befehl = self.BEFEHLE.search(text)
|
||||||
|
if m_befehl:
|
||||||
|
logger.debug("Widerspruch (befehle): matched")
|
||||||
|
return ContradictionResult(
|
||||||
|
has_contradiction=True,
|
||||||
|
contradiction_type="routing_rejection",
|
||||||
|
confidence=self.CONFIDENCE_MAP["befehle"],
|
||||||
|
matched_pattern="befehle",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Kein Widerspruch erkannt
|
||||||
|
return None
|
||||||
Reference in New Issue
Block a user