fuzzysearch icon indicating copy to clipboard operation
fuzzysearch copied to clipboard

Match exceeds max_l_dist when max_substitutions=0 is set

Open markussteindl opened this issue 2 years ago • 1 comments

find_near_matches('xyz', 'wz', max_l_dist=2) works correctly and yields Match(start=1, end=2, dist=2, matched='z').

find_near_matches('xyz', 'wz', max_substitutions=0, max_l_dist=2) does not work correctly since it yields

[{Match} Match(start=0, end=1, dist=2, matched='w'),
 {Match} Match(start=1, end=1, dist=2, matched='')]

The problem is that the substring 'xyz' and the matched part of the string 'w' have distance 3 which is larger than max_l_dist.

markussteindl avatar Jul 11 '22 14:07 markussteindl

Thanks for the report @Stonatus, that looks like a bug!

taleinat avatar Jul 14 '22 18:07 taleinat