Is there a standard way in Python to fuzzy match a string with arbitrary list of acceptable values? -
i hoping function this:
def findsimilar(string, options): .... return astring where astring similar passed string present in options. i'm using function normalize user input toy application i'm working on. read using levenshtein distance, decided ask here, i'm hoping there simple solution in python standard libraries.
use difflib.get_close_matches.
get_close_matches(word, possibilities[, n][, cutoff])
return list of best “good enough” matches. word sequence close matches desired (typically string), , possibilities list of sequences against match word (typically list of strings).
Comments
Post a Comment