Skip to content

Instantly share code, notes, and snippets.

@aneesha
Created November 28, 2017 09:26
Show Gist options
  • Save aneesha/e249d5b69d929a438156b5e9469f823a to your computer and use it in GitHub Desktop.
Save aneesha/e249d5b69d929a438156b5e9469f823a to your computer and use it in GitHub Desktop.
# load the original word vectors and the retrofitted word vectors as separate gensim models
original_glove_model = gensim.models.KeyedVectors.load_word2vec_format('glove.6B.50d.word2vec.txt', binary=False)
retrofitted_glove_model = gensim.models.KeyedVectors.load_word2vec_format('retrofittedglove.word2vec.txt', binary=False)
# display the words closest to 'happy' using the original GLOVE vectors
display_closestwords_tsnescatterplot(original_glove_model, 'happy', 50, 10, "Original Glove Word Vectors - 'Happy'")
# display the words closest to 'happy' using the GLOVE vectors retrofitted with the Paraphrase lexicons
display_closestwords_tsnescatterplot(retrofitted_glove_model, 'happy', 50, 10, "Retroffited Glove Word Vectors - 'Happy'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment