def spell_correct(input, choices, threshold=0.6):
"""
Find a possible spelling correction for a given input.
"""
guesses = difflib.get_close_matches(input, choices, 1, cutoff=threshold)
return next(iter(guesses), None)
文章目录