Skip to content

Instantly share code, notes, and snippets.

@pravj
Created December 24, 2018 21:58
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 pravj/5075bd9fdd7b093ceee1b4da80b249f3 to your computer and use it in GitHub Desktop.
Save pravj/5075bd9fdd7b093ceee1b4da80b249f3 to your computer and use it in GitHub Desktop.
from gensim.models.keyedvectors import KeyedVectors
# load local word2vec model
model = KeyedVectors.load_word2vec_format(
os.getenv('SEMANTRIS_SOLVER_WORD2VEC_PATH'),
binary=True
)
# list of tuples containing the word and similarity score
associated_word_tuples = model.most_similar(word, topn=20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment