Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Oct 4, 2020
Embed
What would you like to do?
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