Files
agent/app/modules/rag/intent_router_v2/negation_detector.py
T

18 lines
488 B
Python

from __future__ import annotations
import re
_TEST_NEG_RE = re.compile(
r"(?:не\s+про\s+тест|без\s+тест|кроме\s+тест|про\s+прод\s+код|только\s+прод|production\s+code)",
re.IGNORECASE,
)
class NegationDetector:
def detect(self, text: str) -> set[str]:
lowered = (text or "").lower()
negations: set[str] = set()
if _TEST_NEG_RE.search(lowered):
negations.add("tests")
return negations