ztane/python-Levenshtein

Early termination for Levenshtein.distance() possible?

Opened this issue · 0 comments

Hello guys!

I would like to propose an enhancement to your project.

What i mean:
similar to the function distance (str1, str2) a function named f.e.: is_distance_bigger_than(str1, str2, int1)
If levenshtein distance between str1 and str2 is bigger than int1 the function would early terminate and return true. So it basically says: yes, the distance beween those strings is bigger than int1. If it is below int1 the function would return false.

Why do i need it?
I am going through large databases of addresses. And i am filtering out the similar ones. The early termination function would be much more quicker. Because i am not interested in the real distance, but whether it is bigger or lesser than my "threshold distance"