Jaro-Winkler distance: Difference between revisions
m
Rust code updated to match spec
m (clarify definition) |
m (Rust code updated to match spec) |
||
Line 681:
=={{header|Rust}}==
{{trans|Python}}
=={{header|Rust}}==
<lang rust>use std::fs::File;
use std::io::{self, BufRead};
Line 696 ⟶ 697:
let mut st1 = string1;
let mut st2 = string2;
std::mem::swap(&mut st1, &mut st2);
std::mem::swap(&mut len1, &mut len2);
}
▲ let len1 = st1.len();
▲ let len2 = st2.len();
if len2 == 0 {
return if len1 == 0 { 0.0 } else { 1.0 };
}
let delta = std::cmp::max(1,
let mut flag = vec![false; len2];
let mut ch1_match = vec![];
Line 855 ⟶ 857:
untie | 0.1067
untimely | 0.1083
Antilles | 0.1264
Close dictionary words (distance < 0.15 using Jaro-Winkler distance) to 'wich' are:
Line 862 ⟶ 864:
witch | 0.0533
which | 0.0600
witches | 0.1143
▲ rich | 0.1167
▲ wick | 0.1167
</pre>
|