Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compare with Partial distances gives negative answers #31

Closed
ericphanson opened this issue Jul 20, 2020 · 4 comments
Closed

compare with Partial distances gives negative answers #31

ericphanson opened this issue Jul 20, 2020 · 4 comments

Comments

@ericphanson
Copy link

julia> compare("ab", "de", Partial(DamerauLevenshtein()))
-1

julia> compare("abc", "de", Partial(DamerauLevenshtein()))
-1

This causes findmax to not work. I think this is due to the normalization changes. This also seems odd:

julia> normalize(Partial(DamerauLevenshtein()))("ab", "cde")
2

julia> normalize(Partial(DamerauLevenshtein()))("ab", "cdef")
2
@matthieugomez
Copy link
Owner

matthieugomez commented Jul 20, 2020

Ok, I had to go back to normalizing Partial/TokenSort/TokenSet, otherwise the package becomes too complicated for me.
I have added tests for your examples in 0.7.2

@ericphanson
Copy link
Author

ericphanson commented Jul 20, 2020

Ok, but this is a breaking change; I've updated my code + compat for 0.7 but I'll have to pin that release then to avoid hitting the normalized methods (at least until I can update again..).

By the way, I think normalize for Partial would be easy enough (just divide by the length of the smaller string), but I haven't looked at the others yet.

@matthieugomez
Copy link
Owner

matthieugomez commented Jul 20, 2020

Ok, then the new version is 0.8. The difficulty is not really about normalizing Partial, it's more about what to do with max_dist, which is not available for all distances. Normalizing a distance always gives a default max_dist = 1.0, which makes it simpler.

@ericphanson
Copy link
Author

Ok, 0.8 sounds good, thanks. That makes sense regarding max_dist, thanks for explaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants