Small one from the bug-hunt. ExactMatch's class docstring says "Comparison is case-insensitive and whitespace-normalized", but the implementation only does .strip().lower() — internal whitespace is not collapsed, so answer="hello world" vs ground_truth="hello world" scores 0.0 despite the documented contract.
Two ways to close it, maintainer's call:
- Make the code match the docstring: normalize with
" ".join(text.lower().split()) — the exact pattern metrics/retrieval/_normalize.py already uses; or
- Make the docstring match the code ("leading/trailing whitespace stripped").
Given the retrieval normalizer precedent I'd lean (1), and it's a two-line change + a test — happy to PR whichever you prefer.
Small one from the bug-hunt.
ExactMatch's class docstring says "Comparison is case-insensitive and whitespace-normalized", but the implementation only does.strip().lower()— internal whitespace is not collapsed, soanswer="hello world"vsground_truth="hello world"scores 0.0 despite the documented contract.Two ways to close it, maintainer's call:
" ".join(text.lower().split())— the exact patternmetrics/retrieval/_normalize.pyalready uses; orGiven the retrieval normalizer precedent I'd lean (1), and it's a two-line change + a test — happy to PR whichever you prefer.