← Lesson
Rules, Prompts, or Train
Joeven
Run
Reset
Python loads on first run
rows = [ ("reset password", "workflow"), ("forgot password", "workflow"), ("where is my invoice", "search"), ("show invoice 17", "search"), ("revenue by week", "sql"), ("count users", "sql"), ] def rule(text): t = text.lower() if "password" in t: return "workflow" if "revenue" in t or "count" in t: return "sql" return "search" def always_search(text): return "search" def acc(fn): return sum(fn(x) == y for x, y in rows) / len(rows) print("always search", acc(always_search)) print("keyword rule ", acc(rule)) print("a 6-row neural net cannot honestly beat a rule that is already 1.0")
Run to execute this in your browser. Nothing is sent to a server.