Been trying to find the closest match to a string from a list of strings.
I've used "difflib" module : https://docs.python.org/3/library/difflib.html
but the results not always as expected.
Example:
import difflib
words_list = ['sprite','coke','lemon sparkling water']
difflib.get_close_matches('watter',words_list)
result:
[]
and I want the result to be:
['lemon sparkling water']
if the list would be:
words_list = ['sprite','coke','lemon sparkling water','water']
the query would have worked
How can I make it work without "water" being the first word in the string?
thanks