Jaro similarity: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,841: | Line 1,841: | ||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
||
<lang Mathematica>ClearAll[ |
<lang Mathematica>ClearAll[JaroDistance] |
||
JaroDistance[s_String, t_String] := Module[{slen, tlen, maxdistance, smatches, tmatches, matches, transpositions, start, end, k, schar, tchar}, |
|||
slen = StringLength[s]; |
slen = StringLength[s]; |
||
tlen = StringLength[t]; |
tlen = StringLength[t]; |
||
Line 1,896: | Line 1,896: | ||
] |
] |
||
] |
] |
||
JaroDistance["DWAYNE", "DUANE"] |
|||
JaroDistance["MARTHA", "MARHTA"] |
|||
JaroDistance["DIXON", "DICKSONX"] |
|||
JaroDistance["JELLYFISH", "SMELLYFISH"]</lang> |
|||
{{out}} |
{{out}} |
||
<pre>0.822222 |
<pre>0.822222 |