The Jaro-Winkler distance is a measure of dissimilarity between two strings that gives additional weight to a common prefix. For strings and
, let
be the number of matching characters within the matching window,
and let
be half the number of out-of-order matches. When
, the Jaro similarity is
|
(1)
|
The matching window has radius . If
, then
.
If
is the length of the common prefix, usually capped at 4, and
is a prefix scaling factor, usually
, then when
exceeds a similarity threshold, usually
, the Jaro-Winkler similarity is
|
(2)
|
Otherwise, .
The associated distance is
|
(3)
|
With the usual choices and
, it lies between 0 and 1, with 0 indicating identical
strings. Despite its name, it does not in general satisfy the triangle
inequality.