1

I want to fetch vector representation of words. I tried to use GENSIM api but got the same error as here (for Python 3.6): ValueError when downloading gensim data set

What is the best way to get the vector out of the pre-trained model?

Cranjis
  • 1,590
  • 8
  • 31
  • 64

1 Answers1

1

You can download the compressed vectors directly form the Google link on the page:

https://code.google.com/archive/p/word2vec/

(Search for GoogleNews-vectors to find the link about 2/3 through the page.)

Take note of the local file path where you downloaded the file.

Then load the set of vecors as a Gensim KeyedVectors model:

from gensim.models import KeyedVectors

goog_model = KeyedVectors.load_word2vec_format('/WHERE/YOU/DOWNLOADED/GoogleNews-vectors-negative300.bin.gz', binary=True)
gojomo
  • 52,260
  • 14
  • 86
  • 115