Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def recommendation(word):
- n = 3
- # n means 'n'-grams, here I use 3 as an example
- spellings_new = [w for w in spellings if (w[0] == word[0])]
- dists = [jaccard_distance(set(w), set(word)) for w in spellings_new]
- return spellings_new[dists.index(min(dists))]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement