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

Add "Results could differ" in warning message when using slow pure-python SequenceMatcher #298

Open
ivsanro1 opened this issue Feb 9, 2021 · 0 comments

Comments

@ivsanro1
Copy link

ivsanro1 commented Feb 9, 2021

We just found that fuzz.WRatio() gives different results depending if python-Levenshtein is installed or not.

Given the warning message when importing fuzzywuzzy.fuzz and python-Levenshtein is not installed:

/usr/local/lib/python3.6/site-packages/fuzzywuzzy/fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')

The user will think that the difference is purely in terms of speed, which is not.

Versions used:

fuzzywuzzy==0.18.0
python-Levenshtein==0.12.0

Example of score differences :

>>> from fuzzywuzzy import fuzz
/usr/local/lib/python3.6/site-packages/fuzzywuzzy/fuzz.py:11: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning
  warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
>>> fuzz.WRatio('Copia', 'electronica')
50
>>> from fuzzywuzzy import fuzz
>>> fuzz.WRatio('Copia', 'electronica')
54

We strongly suggest to specify in the warning message that results could differ between the "pure-python SequenceMatcher" and the python-Levenshtein version:

warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning. Results can be different between SequenceMatchers')
@ivsanro1 ivsanro1 changed the title Add "Results could differ" in warning when using slow pure-python SequenceMatcher Add "Results could differ" in warning message when using slow pure-python SequenceMatcher Feb 9, 2021
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

1 participant