Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Jaro–Winkler distance

From Wikipedia, the free encyclopedia
String distance measure
This article is about the measure. For other uses, seeJaro.

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 scalep{\displaystyle p} which gives more favourable ratings to strings that match from the beginning for a set prefix length{\displaystyle \ell }.

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.

Definition

[edit]

Jaro similarity

[edit]

The Jaro similaritysimj{\displaystyle {\text{sim}}_{j}} of two given stringss1{\displaystyle s_{1}} ands2{\displaystyle s_{2}} is

simj={0if m=013(m|s1|+m|s2|+mtm)otherwise{\displaystyle {\text{sim}}_{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:

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 ofs1{\displaystyle s_{1}} is compared with all its matching characters ins2{\displaystyle s_{2}}. Two characters froms1{\displaystyle s_{1}} ands2{\displaystyle s_{2}} respectively, are consideredmatching only if they are the same and not farther thanmax(|s1|,|s2|)21{\displaystyle \left\lfloor {\frac {\max(|s_{1}|,|s_{2}|)}{2}}\right\rfloor -1} 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 ofmax(9,9)21{\displaystyle \lfloor {\tfrac {\max(9,9)}{2}}\rfloor -1}) 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 charactersm{\displaystyle m} and number of transpositionst{\displaystyle t} the Jaro similarity of FAREMVIEL and FARMVILLE can be calculated,13(89+89+818)=0.88{\displaystyle {\frac {1}{3}}\left({\frac {8}{9}}+{\frac {8}{9}}+{\frac {8-1}{8}}\right)=0.88}

Jaro–Winkler similarity

[edit]

Jaro–Winkler similarity uses aprefix scalep{\displaystyle p} which gives more favorable ratings to strings that match from the beginning for a set prefix length{\displaystyle \ell }. Given two stringss1{\displaystyle s_{1}} ands2{\displaystyle s_{2}}, their Jaro–Winkler similaritysimw{\displaystyle {\text{sim}}_{w}} is:

simw=simj+p(1simj),{\displaystyle {\text{sim}}_{w}={\text{sim}}_{j}+\ell p(1-{\text{sim}}_{j}),}

where:

The Jaro–Winkler distancedw{\displaystyle d_{w}} is defined asdw=1simw{\displaystyle d_{w}=1-{\text{sim}}_{w}}.

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 axiomd(x,y)=0x=y{\displaystyle d(x,y)=0\leftrightarrow x=y}.

Relationship with other edit distance metrics

[edit]
Main article:Edit distance

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.

See also

[edit]

Footnotes

[edit]
  1. ^Jaro, Matthew A. (1 June 1989)."Advances in Record-Linkage Methodology as Applied to Matching the 1985 Census of Tampa, Florida".Journal of the American Statistical Association. pp. 414–420.doi:10.1080/01621459.1989.10478785.
  2. ^Winkler, William E. (1990)."String Comparator Metrics and Enhanced Decision Rules in the Fellegi-Sunter Model of Record Linkage".
  3. ^"What is Jaro-Winkler Similarity?".www.baseclass.io. Archived from the original on 28 January 2024. Retrieved26 July 2012.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  4. ^"Jaro-Winkler «  Inviting Epiphany".RichardMinerich.com. Retrieved12 June 2017.

References

[edit]

External links

[edit]
String metric
String-searching algorithm
Multiple string searching
Regular expression
Sequence alignment
Data structure
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=Jaro–Winkler_distance&oldid=1315882808"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp