Reputation: 1960
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?
Upvotes: 2
Views: 2779
Reputation: 54210
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)
Upvotes: 1