Similarity between two (possibly compound) surnames
compare_two_names.RdReturns the maximum of two views, which together are robust to the two ways a parser mangles a surname without changing the person:
- whole-string
Jaro-Winkler on the names with all separators removed. Rescues separator noise where token splitting fails —
"MCLANE"vs"MC-LANE"collapse to the same string (1.0), and"VANDERBERG"vs"VAN DER BERG"likewise.- coverage token-match
Greedy one-to-one Jaro-Winkler matching of the tokens, summing matched similarities and dividing by the smaller token count. Rescues a dropped or reordered token —
"ANDREWS-MCLANE"vs"MCLANE"is 1.0 because the shorter name is fully covered — while penalising two different multi-token surnames that merely share one token:"WEINER-COHEN"vs"COHEN-GANTSOUDES"scores low, not 1.0.
The earlier "best single token" rule returned 1.0 for the latter case, letting two different people who share one surname token look identical; dividing by the smaller token count is what closes that leak.