You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
When using partial_ratio with python-Levenshtein it is not guaranteed to use the best aligned string, even though thats the purpose of partial_ratio.
As an example:
>>>fuzz.partial_ratio("aaaa", "babaaaab")
75.0
Here the best aligned string is a exact match. However the get_matching_blocks method from python-Levenshtein only finds the alignment aaaa <-> abaa and therefore calculates a ratio of 75% in partial_ratio.
In my opinion it should be either explicitly mentioned (probably in the docstring), that when using python-Levenshtein this function is not guaranteed to use the best aligned string, or it should keep using difflib to calculate the matching_blocks and python-Levenshtein only for the final ratio calculation when looping over the matching_blocks even when python-Levenshtein is available.
The text was updated successfully, but these errors were encountered:
When using
partial_ratio
with python-Levenshtein it is not guaranteed to use the best aligned string, even though thats the purpose ofpartial_ratio
.As an example:
Here the best aligned string is a exact match. However the get_matching_blocks method from python-Levenshtein only finds the alignment
aaaa
<->abaa
and therefore calculates a ratio of 75% in partial_ratio.In my opinion it should be either explicitly mentioned (probably in the docstring), that when using python-Levenshtein this function is not guaranteed to use the best aligned string, or it should keep using difflib to calculate the matching_blocks and python-Levenshtein only for the final ratio calculation when looping over the matching_blocks even when python-Levenshtein is available.
The text was updated successfully, but these errors were encountered: