My problem is less about Rust specifically, and more about problems implementing a specific algorithm in Rust.
I'm attempting to implement the jaro and jaro-winkler similarity algorithms in Rust, as a learning exercise. I've attempted to implement based on the wikipedia article and other resources I've found on the web. The jaro-winkler paper was more dense than I could stomach, but I took the test cases from there, to augment my own testing.
The code is available in my jaro-winkler github repo
It turns out my implementation is not passing those tests. It seems clear that I've misunderstood something, but without knowing what the
t are supposed to be in the given instances...I've just gotten stuck trying to determine where I'm going wrong.
Some example output from my failing test:
[src/jaro.rs:80] s1 = 11.0 [src/jaro.rs:80] s2 = 11.0 [src/jaro.rs:80] m = 11.0 [src/jaro.rs:80] t = 0.0 [src/jaro.rs:81] ((m / s1) + (m / s2) + ((m - t) / m)) / 3.0 = 1.0 [src/jaro.rs:101] &p = 0.1 [src/jaro.rs:102] &l = 4.0 [src/jaro.rs:103] sim_j + (p * l * (1.0 - sim_j)) = 1.0 [src/jaro.rs:227] s1 = "SHACKLEFORD" [src/jaro.rs:227] s2 = "SHACKELFORD" [src/jaro.rs:228] &score_round = 1.0 [src/jaro.rs:228] score = 0.982
I think what is tripping me up is that a lack of clarity regarding transpositions vs matches within the allowed range, maybe. In this example, I've clearly not caught the
L transposition somehow.
Anyway, this isn't anything particularly important, I've just gotten really frustrated that what seemed like it was going to be a simple exercise has ended up turning into a brick wall :-/
If you see rust specific problems with my code, I'm interested in learning about that as well, of course!