Skip to content

Instantly share code, notes, and snippets.

@lucascheung
Created September 1, 2020 12:32
Show Gist options
  • Save lucascheung/a95c38a4ff0e03f93473c163205e91df to your computer and use it in GitHub Desktop.
Save lucascheung/a95c38a4ff0e03f93473c163205e91df to your computer and use it in GitHub Desktop.
Autocorrect misspelled words from a master list.
from fuzzywuzzy import process
def find_best_match(misspelled, correct_names):
closest, ratio = process.extractOne(misspelled, correct_names)
return closest
print(find_best_match('noo yurk', ['New York', 'Boston', 'Washington']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment