Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2020 08:34
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')
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment