File size: 456 Bytes
63c75d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from config import settings


_NOISE_PATTERNS = [p.strip() for p in settings.tool_noise_patterns.split(",")]


def is_noise(clean_text: str) -> bool:
    """Return True if this tool result should be dropped entirely."""
    if not clean_text:
        return True
    lower = clean_text.lower()
    for pat in _NOISE_PATTERNS:
        if pat.lower() in lower:
            return True
    if len(clean_text.strip()) < 2:
        return True
    return False