concept
Automation quality and human review
Paired fixture metrics: exact routes, correction count, handling time and severity.
Formal Syntax & Structure
artificial-intelligence syntaxartificial-intelligence
summarize(rows)Working Example
Example Snippetartificial-intelligence
def summarize(rows): # Each case: (expected route, proposed route, handling seconds, severity). # Severity is a human label, 0 for correct, 1 low, 3 high. if any(type(t) is not int or t < 0 or type(s) is not int or s not in (0,1,3) or ((a == b) != (s == 0)) for a,b,t,s in rows): raise ValueError("invalid evaluation row") return {"cases":len(rows), "correct":sum(a==b for a,b,_,_ in rows), "corrections":sum(a!=b for a,b,_,_ in rows), "seconds":sum(t for _,_,t,_ in rows), "severity_points":sum(s for _,_,_,s in rows), "high_errors":sum(s==3 for _,_,_,s in rows)}
rule = [("billing","billing",30,0),("technical","review",50,1), ("review","review",40,0),("technical","technical",30,0), ("review","billing",60,3)]mock = [("billing","billing",20,0),("technical","technical",20,0), ("review","review",35,0),("technical","review",45,1), ("review","review",35,0)]print(summarize(rule))print(summarize(mock))