Scoring — Phone
mercury.score.score_phone(link_phones: list[str], customer_phone: str) -> float
Normalization
Input strings are reduced by mercury.normalize.normalize_phone:
- Strip every non-digit character.
- Keep the last 10 digits (drops
+1and other country prefixes, any extension appended to the end). - If fewer than 10 digits remain, the value is treated as empty.
Agreement rule
The score is 1.0 if any entry in link_phones normalizes to the same 10-digit string as the customer’s normalized phone; 0.0 otherwise. There is no partial credit — a phone either matches exactly or it doesn’t.
Inputs in the interview fixtures
All four formats present in third-party-banks.json collapse to the same normalized form:
| Raw | Normalized |
|---|---|
5557609870 | 5557609870 |
(555)-760-9870 | 5557609870 |
555 098 9870 | 5550989870 |
555-010-9988 | 5550109988 |
+1 (555) 760-9870 | 5557609870 |
Edge cases
- Empty list on the link side → 0.0 (no signal).
- Empty customer phone → 0.0 (defensive).
- Multiple link phones — any one agreeing is sufficient; the function short-circuits on the first match.
Combiner contribution
Weight: PHONE_WEIGHT = 1.5 (see scoring-combiner). A phone match alone contributes 1.5 to the total — below the 2.5 threshold. Corroboration is required.