Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#334·fuzzywuzzy

problem of fuzz.ratio with newer ver (22) of python-Lev. distance

Author: orellavie1212Created Oct 1, 2023Updated Oct 1, 2023

Hey, After testing failure of fuzz.ratio at the detection of basic sim. match, I found that the newer ver of python-Levenshtein(0.22.0) makes the fuzz.ratio output wrong answer when installing it with fuzzywuzzy (latest version of fuzzy). Here is an example of the wrong output: code: from fuzzywuzzy import fuzz list_to_search_from = ['Barcelona', 'Real Madrid'] text_to_search = 'real' scores = {search_option: fuzz.ratio(search_option, text_to_search) for search_option in list_to_search_from} output: {‘Barcelona’: 46, ‘Real Madrid’: 40} with ver 21.1 {'Barcelona': 31, 'Real Madrid': 40} which is the right answer.

After downgrade to 21.1 it works nice, didn't find where it fails on 22. Note, without python-Levenshtein install at all (clean, checked with colab with and without) it works like a charm. Wonder why it happens (maybe wrong calc of Lev. dist at the new ver) !pip install python-Levenshtein==0.21.1

Source: seatgeek/fuzzywuzzy

View original on GitHubView discussion on GitHub