Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created October 4, 2020 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/769460f85a59366c54c146e6fd93674d to your computer and use it in GitHub Desktop.
Save amankharwal/769460f85a59366c54c146e6fd93674d to your computer and use it in GitHub Desktop.
def my_autocorrect(input_word):
input_word = input_word.lower()
if input_word in V:
return('Your word seems to be correct')
else:
similarities = [1-(textdistance.Jaccard(qval=2).distance(v,input_word)) for v in word_freq_dict.keys()]
df = pd.DataFrame.from_dict(probs, orient='index').reset_index()
df = df.rename(columns={'index':'Word', 0:'Prob'})
df['Similarity'] = similarities
output = df.sort_values(['Similarity', 'Prob'], ascending=False).head()
return(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment