Search code examples
python-2.7freebasegensimgoogle-news

Unable to find words when using freebase with word2vec


I am trying to use freebase along with gensim's word2vec to find similarity score between vectors of two word using following code.

model = gensim.models.Word2Vec()
model = models.Word2Vec.load_word2vec_format('freebase-vectors-skipgram1000-en.bin.gz', binary=True)

after creating a model based on freebase my code is giving me key error for any word.

model.similarity('microsoft', 'apple')

This is giving me KeyError: 'microsoft'

But when I use googlenews instead of freebase it works fine. Any idea why?


Solution

  • model.similarity('/en/microsoft', '/en/apple')