Chatbot normalized exact match
Your task
You are scoring a chatbot's short answers against a reference answer key using normalized exact match. Given equal-length lists outputs and references, normalize each string by lowercasing it, trimming leading and trailing whitespace, and collapsing every internal run of whitespace to a single space. Return the number of positions where the normalized output equals the normalized reference. Example: outputs = [" Paris ", "london"], references = ["paris", "Berlin"] returns 1.
Examples
exact_match_count(outputs: list[str], references: list[str]) -> intExample 1
Input
exact_match_count([" Paris ", "london"], ["paris", "Berlin"])Output
1