Open rralf opened 6 years ago
Pull requests - with the accompanying tests - are welcome and encouraged :)
First I'd like to discuss those issues, I didn't have a look into the code yet. Additionally I still have to check if this behaviour depends on python-levenshtein (which I'm using) or not.
Maybe there's even some rationale behind this and the behaviour is intended for some reason.
Or in other words: Am I facing a bug or does it work as intended? :-)
From my perspective, the tests pass, so any behavior is expected. If you can add this functionality and tests continue to pass, great!
One thing to note is that the ratio may be misleading if the tokens are all the same but actually mis-ordered. That might have actual implications on someone's code, but if we're not testing for that now, its fine to break imo.
I'm currently writing some patches.
Think I will have to touch the check_for_none and check_empty_string decorators... Let me return with a pull request in a couple of hours.
Please be sure to include perf benchmarks :)
@rralf I looked over those changes and can assure @josegonzalez that they are performant. @josegonzalez do you actually need a perf tests here? This changeset looks good to me.
Sounds fine with me. PR it.
Huh, that went quickly... Thanks for reviewing.
Hi,
following issue(s) can be reproduced with python-levenshtein 0.12.0 and fuzzywuzzy 0.16.0
There are several combinations that should be considered similar while being scored as absolutely dissimilar.
fuzz.ratio('', '')
evaluates to 0. Two empty absolutely identical, so this should be 100.fuzz.ratio('{', '{')
evaluates to 100, whilefuzz.token_sort_ratio(['{'], ['{'])
evaluates erroneously to 0. Inconsistently,fuzz.token_sort_ratio(['{a'], ['{a'])
evaluates to 100. (which is correct IMO).Proposal: Independent of the method, fuzzywuzzy should always return 100 if both arguments are absolutely equal. I think this could efficiently be checked.
Thanks!