Skip to content

Instantly share code, notes, and snippets.

@joshkyh
Last active January 30, 2018 10:23
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 joshkyh/ac70176080a21ff5a800466cf169ac65 to your computer and use it in GitHub Desktop.
Save joshkyh/ac70176080a21ff5a800466cf169ac65 to your computer and use it in GitHub Desktop.
word2vec_emotions.py
import gensim
from gensim.models.keyedvectors import KeyedVectors
# Load Google's pre-trained Word2Vec model.
model = KeyedVectors.load_word2vec_format('I:/Downloads/GoogleNews-vectors-negative300.bin/GoogleNews-vectors-negative300.bin', binary=True)
word1 = 'anger'
word2 = 'trust'
model.most_similar(positive = [word1, word2])
word_w2v = 'resentment'
plutchik = 'dominance'
model.wv.similarity(word_w2v,plutchik)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment