Gensim error while importing Word2Vec model
I am trying to import an uploaded model from google. I do this using the following code:
import gensim
model= gensim.models.KeyedVectors.load_word2vec_format('C://gensim/model/GoogleNews-vectors-negative300.bin.gz', binary=True)
However, I get this error on startup:
File "C:\Users\Acer\AppData\Local\Programs\Python\Python36-32\lib\site packages\smart_open\smart_open_lib.py", line 309, in __init__
raise NotImplementedError("unknown URI scheme %r in %r" % (self.scheme, uri))
NotImplementedError: unknown URI scheme 'c' in 'C://gensim/model/GoogleNews-vectors-negative300.bin.gz'
Correct file path and model name, however I cannot import it correctly. I have used this tutorial.
Any suggestions?
thank
source to share
It seems that the problem is with your path parameter.
You should use a backslash ( \
) instead of a forward slash for your path.
Alternatively, you can use a module os.path
to build the path, regardless of platform.
Finally, you can use a relative path. For example, put your file in a folder when you start your python program and use './filename.bin.gz'
as a parameter.
For more information , this article details the use of forward slashes and backslashes in python.
source to share