Chatbot normalized exact match

Write codeEasy12 minOpenAI and Anthropic style

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]) -> int
Example 1
Inputexact_match_count([" Paris ", "london"], ["paris", "Berlin"])
Output1