In [43]:
import gensim

In [44]:
model = gensim.models.Word2Vec.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True)

In [46]:
def analogy(a, b, c):
    return model.most_similar(positive=[b, c], negative=[a], topn=10)

In [69]:
analogy('jazz', 'Art_Pepper', 'pop')


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-69-c8151331b505> in <module>()
----> 1 analogy('jazz', 'Art_Pepper', 'pop')

<ipython-input-46-1a9147e109bd> in analogy(a, b, c)
      1 def analogy(a, b, c):
----> 2     return model.most_similar(positive=[b, c], negative=[a], topn=10)

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gensim/models/word2vec.pyc in most_similar(self, positive, negative, topn)
    658                 all_words.add(self.vocab[word].index)
    659             else:
--> 660                 raise KeyError("word '%s' not in vocabulary" % word)
    661         if not mean:
    662             raise ValueError("cannot compute similarity with no input")

KeyError: "word 'Art_Pepper' not in vocabulary"

In [ ]: