/** * Address tokenisation + match scoring — the canonical helper * reconciling four cohort implementations. * * Surveyed implementations: * * - compass-mcp `src/tools/by-address.ts` `addressMatchesQuery` / * `normalizeAddressForMatch` — NFKD diacritic strip, comma/slash * collapse, street-type canonicalisation, token-equality, numeric * token required. * - homes-mcp `src/tools/by-address.ts` — relies on homes.com's own * slug routing, with a post-hoc token-overlap check on the * returned street_address. * - onehome-mcp `src/tools/by-address.ts` — fuzzy normalisation * via `joinNonEmpty` + comparison against reconstructed street * parts. * - redfin-mcp `src/resolve.ts` `scoreStreetMatch` — token-overlap * scorer with a strict numeric-prefix anchor. * * Differences reconciled here: * * - Compass requires EVERY query token to appear → too strict for * redfin's autocomplete results where the candidate often drops the * unit number. * - Redfin scored 0..1 with a threshold of `>= 0.5` → too lax, * accepts even tokens (homes #50 closed by tightening to `> 0.5`). * - Homes drops short tokens (< 3 chars) at tokenise time so suffix * abbrev noise vanishes ("Ln" / "St" never enter the score). * * Canonical policy: * * 1. Drop sub-3-char tokens (homes convergence) — absorbs USPS * abbreviation drift without needing the SUFFIX_PAIRS table at * this layer. * 2. Anchor on the leading numeric token (redfin's * `scoreStreetMatch`) — street number MUST match exactly. * 3. Score = |query ∩ candidate| / |query| over the kept tokens. * 4. Threshold > 0.5 (strict majority) — homes #50. */ /** * Lowercase, strip punctuation, split on whitespace, drop tokens * shorter than 3 characters EXCEPT for the leading numeric token * (the street number — must always survive so the anchor below has * something to work with). */ export declare function tokenize(input: string): string[]; export interface AddressMatchResult { matched: boolean; score: number; } /** * Token-equality match with anchored numeric prefix. */ export declare function addressMatch(input: string, candidate: string): AddressMatchResult;