Skip to content

Instantly share code, notes, and snippets.

@amn41
Last active February 10, 2018 22:21
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 amn41/1589dd6a6dfd6d0b6d1e921d5a9d6c21 to your computer and use it in GitHub Desktop.
Save amn41/1589dd6a6dfd6d0b6d1e921d5a9d6c21 to your computer and use it in GitHub Desktop.
vocab_file ="/path/to/vocab_file"
vectors_file ="/path/to/vectors_file"
embed = Embedding(vocab_file,vectors_file)
cuisine_refs = ["mexican","chinese","french","british","american"]
threshold = 0.2
text = "I want to find an indian restaurant"
cuisines = find_similar_words(embed,cuisine_refs,text,threshold)
print(cuisines)
# >>> ['indian']
@mohamsh
Copy link

mohamsh commented Sep 28, 2017

how do I get the files vocab_file and vectors_file?

@joemalle
Copy link

I was unable to replicate your result. I downloaded a vocab file with 10000 most common words and skipped words not in the GloVe file. For me, this script prints ['want', 'to', 'find', 'an', 'indian', 'restaurant']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment