Incomputer science andstatistics, theJaro–Winkler similarity is astring metric measuring anedit distance between two sequences. It is a variant of theJaro distance metric[1] (1989, Matthew A. Jaro) proposed in 1990 byWilliam E. Winkler.[2]
The Jaro–Winkler distance uses aprefix scale which gives more favourable ratings to strings that match from the beginning for a set prefix length.
The higher the Jaro–Winkler distance for two strings is, the less similar the strings are. The score is normalized such that 0 means an exact match and 1 means there is no similarity. The original paper actually defined the metric in terms of similarity, so the distance is defined as the inversion of that value (distance = 1 − similarity).
Although often referred to as adistance metric, the Jaro–Winkler distance is not ametric in the mathematical sense of that term because it does not obey thetriangle inequality.
The Jaro similarity of two given strings and is
Where:
Jaro similarity score is 0 if the strings do not match at all, and 1 if they are an exact match. In the first step, each character of is compared with all its matching characters in. Two characters from and respectively, are consideredmatching only if they are the same and not farther than characters apart. For example, the following two nine character long strings, FAREMVIEL and FARMVILLE, have 8 matching characters. 'F', 'A' and 'R' are in the same position in both strings. Also 'M', 'V', 'I', 'E' and 'L' are within three (result of) characters away.[3] If no matching characters are found then the strings are not similar and the algorithm terminates by returning Jaro similarity score 0.
If non-zero matching characters are found, the next step is to find the number of transpositions. Transposition is the number of matching characters that are not in the right order divided by two. In the above example between FAREMVIEL and FARMVILLE, 'E' and 'L' are the matching characters that are not in the right order. So the number of transposition is one.
Finally, plugging in the number of matching characters and number of transpositions the Jaro similarity of FAREMVIEL and FARMVILLE can be calculated,
Jaro–Winkler similarity uses aprefix scale which gives more favorable ratings to strings that match from the beginning for a set prefix length. Given two strings and, their Jaro–Winkler similarity is:
where:
The Jaro–Winkler distance is defined as.
Although often referred to as adistance metric, the Jaro–Winkler distance is not ametric in the mathematical sense of that term because it does not obey thetriangle inequality.[4] The Jaro–Winkler distance also does not satisfy the identity axiom.
There are other popular measures ofedit distance, which are calculated using a different set of allowable edit operations. For instance,
Edit distance is usually defined as a parameterizable metric calculated with a specific set of allowed edit operations, and each operation is assigned a cost (possibly infinite). This is further generalized by DNAsequence alignment algorithms such as theSmith–Waterman algorithm, which make an operation's cost depend on where it is applied.
{{cite web}}: CS1 maint: bot: original URL status unknown (link)