-
-
Save amankharwal/769460f85a59366c54c146e6fd93674d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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