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

fuzz.token_set_ratio blank string does not match itself #70

Open
LTepliakov opened this issue Dec 25, 2023 · 2 comments
Open

fuzz.token_set_ratio blank string does not match itself #70

LTepliakov opened this issue Dec 25, 2023 · 2 comments

Comments

@LTepliakov
Copy link

All below cases return 0.
fuzz.token_set_ratio("","")
fuzz.token_set_ratio(" "," ")
fuzz.token_set_ratio("%","%")
fuzz.token_set_ratio("%","%%")
As far as I understand all this characters are considered blank, but by my mind it would be natural to consider them same and return 100, as rapidfuzz does in this case.

@maxbachmann
Copy link
Contributor

rapidfuzz just doesn't preprocess strings by default, while thefuzz runs a preprocessing function removing these characters. You can disable this behavior in thefuzz:

>>> thefuzz.fuzz.token_set_ratio("%","%")
0
>>> thefuzz.fuzz.token_set_ratio("%","%", full_process=False)
100

or enable it in rapidfuzz

>>> rapidfuzz.fuzz.token_set_ratio("%","%")
100.0
>>> rapidfuzz.fuzz.token_set_ratio("%","%", processor=rapidfuzz.utils.default_process)
0.0

@LTepliakov
Copy link
Author

LTepliakov commented Dec 25, 2023 via email

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