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[MyJaroDistance]
<lang Mathematica>ClearAll[JaroDistance]
MyJaroDistance[s_String, t_String] := Module[{slen, tlen, maxdistance, smatches, tmatches, matches, transpositions, start, end, k, schar, tchar},
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:
]
]
]
]
MyJaroDistance["DWAYNE", "DUANE"]
JaroDistance["DWAYNE", "DUANE"]
MyJaroDistance["MARTHA", "MARHTA"]
JaroDistance["MARTHA", "MARHTA"]
MyJaroDistance["DIXON", "DICKSONX"]
JaroDistance["DIXON", "DICKSONX"]
MyJaroDistance["JELLYFISH", "SMELLYFISH"]</lang>
JaroDistance["JELLYFISH", "SMELLYFISH"]</lang>
{{out}}
{{out}}
<pre>0.822222
<pre>0.822222