# Jaro–Winkler distance

{{#invoke:Hatnote|hatnote}}

{{ safesubst:#invoke:Unsubst||$N=Original research |date=__DATE__ |$B= {{#invoke:Message box|ambox}} }} Template:Notability

In computer science and statistics, the Jaro–Winkler distance (Winkler, 1990) is a measure of similarity between two strings. It is a variant of the Jaro distance metric (Jaro, 1989, 1995), a type of string edit distance, and was developed in the area of record linkage (duplicate detection) (Winkler, 1990). The higher the Jaro–Winkler distance for two strings is, the more similar the strings are. The Jaro–Winkler distance metric is designed and best suited for short strings such as person names. The score is normalized such that 0 equates to no similarity and 1 is an exact match.

## Definition

$d_{j}=\left\{{\begin{array}{l l}0&{\text{if }}m=0\\{\frac {1}{3}}\left({\frac {m}{|s_{1}|}}+{\frac {m}{|s_{2}|}}+{\frac {m-t}{m}}\right)&{\text{otherwise}}\end{array}}\right.$ where:

Each character of $s_{1}$ is compared with all its matching characters in $s_{2}$ . The number of matching (but different sequence order) characters divided by 2 defines the number of transpositions. For example, in comparing CRATE with TRACE, only 'R' 'A' 'E' are the matching characters, i.e. m=3. Although 'C', 'T' appear in both strings, they are farther than 1, i.e., floor(5/2)-1=1. Therefore, t=0 . In DwAyNE versus DuANE the matching letters are already in the same order D-A-N-E, so no transpositions are needed.

$d_{w}=d_{j}+(\ell p(1-d_{j}))$ where:

Although often referred to as a distance metric, the Jaro–Winkler distance is actually not a metric in the mathematical sense of that term because it does not obey the triangle inequality .

In some implementations of Jaro-Winkler, the prefix bonus $\ell p(1-d_{j})$ is only added when the compared strings have a Jaro distance above a set "boost threshold" $b_{t}$ . The boost threshold in Winkler's implementation was 0.7.

$d_{w}=\left\{{\begin{array}{l l}d_{j}&{\text{if }}d_{j} ## Example

Note that Winkler's "reference" C code differs in at least two ways from published accounts of the Jaro–Winkler metric. First is his use of a typo table (adjwt) and also some optional additional tolerance for long strings.

We find a Jaro score of:

To find the Jaro–Winkler score using the standard weight $p=0.1$ , we continue to find:

Thus:

$d_{w}=0.944+(3*0.1(1-0.944))=0.961$ We find a Jaro score of:

$d_{j}={\frac {1}{3}}\left({\frac {4}{6}}+{\frac {4}{5}}+{\frac {4-0}{4}}\right)=0.822$ To find the Jaro–Winkler score using the standard weight $p=0.1$ , we continue to find:

Thus:

$d_{w}=0.822+(1*0.1(1-0.822))=0.84$ D I X O N D 1 0 0 0 0 I 0 1 0 0 0 C 0 0 0 0 0 K 0 0 0 0 0 S 0 0 0 0 0 O 0 0 0 1 0 N 0 0 0 0 1 X 0 0 0 0 0

We find a Jaro score of:

$d_{j}={\frac {1}{3}}\left({\frac {4}{5}}+{\frac {4}{8}}+{\frac {4-0}{4}}\right)=0.767$ To find the Jaro–Winkler score using the standard weight $p=0.1$ , we continue to find:

Thus:

$d_{w}=0.767+(2*0.1(1-0.767))=0.814$ 