I am new in algorithms and my question may be silly, but how can I specify the edit distance in fuzzywuzzy library? I want edit distance <= 1 between two strings.
from fuzzywuzzy import fuzz
fuzz.ratio('Apple', 'Aple')
I tried to look at source code, but I didn't understand how to customize
Are you restricted in any way to use the fuzzywuzzy
library? The ratio
function does not have parameters to set the edit distance threshold. You could of course alter the source code, however this is something you generally avoid as it is hard to maintain (for example when fuzzywuzzy
gets an update).
You could simply implement the ratio
function yourself, for example based on https://github.com/miohtama/python-Levenshtein
or https://github.com/aflc/editdistance