File size: 377 Bytes
6733714
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def estimate_confidence(context: str) -> float:
    """
    Very simple, honest confidence estimator.
    """
    if not context or len(context.strip()) < 50:
        return 0.4

    if any(rate in context for rate in ["12%", "18%", "5%", "28%"]):
        return 0.9

    if "notification" in context.lower() or "section" in context.lower():
        return 0.8

    return 0.6