Python Gensim入门错误:没有这样的文件或目录:';向量。bin';

Python Gensim入门错误:没有这样的文件或目录:';向量。bin';,python,error-handling,gensim,word2vec,Python,Error Handling,Gensim,Word2vec,我正在学习python中的Word2Vec和GloVe模型,因此我将使用可用的GENSIM完成本入门课程 在Idle3中逐步编译这些代码之后: from gensim.models import word2vec import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) sentences = word2vec.Text8Corpus('te

我正在学习python中的Word2VecGloVe模型,因此我将使用可用的GENSIM完成本入门课程

在Idle3中逐步编译这些代码之后:

from gensim.models import word2vec
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
sentences = word2vec.Text8Corpus('text8')
sentences = word2vec.Text8Corpus('~/Desktop/text8')
model = word2vec.Word2Vec(sentences, size=200)
model.most_similar(positive=['woman', 'king'], negative=['man'], topn=1)
model.most_similar(positive=['woman', 'king'], negative=['man'], topn=2)
model.most_similar(['man'])
model.save('text8.model')
model.save_word2vec_format('text.model.bin', binary=True)
model1 = word2vec.Word2Vec.load_word2vec_format('text.model.bin', binary=True)
model1.most_similar(['girl', 'father'], ['boy'], topn=3)
more_examples = ["he is she", "big bigger bad", "going went being"]
for example in more_examples:
    a, b, x = example.split()
    predicted = model.most_similar([x, b], [a])[0][0]
    print ("'%s' is to '%s' as '%s' is to '%s'" % (a, b, x, predicted))
model_org = word2vec.Word2Vec.load_word2vec_format('vectors.bin', binary=True)
我得到这个错误:

2017-01-17 10:34:26,054 : INFO : loading projection weights from vectors.bin
Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    model_org = word2vec.Word2Vec.load_word2vec_format('vectors.bin', binary=True)
  File "/usr/local/lib/python3.5/dist-packages/gensim/models/word2vec.py", line 1172, in load_word2vec_format
    with utils.smart_open(fname) as fin:
  File "/usr/local/lib/python3.5/dist-packages/smart_open-1.3.5-py3.5.egg/smart_open/smart_open_lib.py", line 127, in smart_open
    return file_smart_open(parsed_uri.uri_path, mode)
  File "/usr/local/lib/python3.5/dist-packages/smart_open-1.3.5-py3.5.egg/smart_open/smart_open_lib.py", line 558, in file_smart_open
    return open(fname, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'vectors.bin'
2017-01-17 10:34:26054:信息:从vectors.bin加载投影权重
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
model\u org=word2vec.word2vec.load\u word2vec\u格式('vectors.bin',binary=True)
文件“/usr/local/lib/python3.5/dist packages/gensim/models/word2vec.py”,第1172行,load\U word2vec\u格式
使用utils.smart_open(fname)作为fin:
文件“/usr/local/lib/python3.5/dist packages/smart\u open-1.3.5-py3.5.egg/smart\u open/smart\u open\u lib.py”,第127行,在smart\u open中
返回文件\u smart\u open(解析的\u uri.uri\u路径,模式)
文件“/usr/local/lib/python3.5/dist packages/smart\u open-1.3.5-py3.5.egg/smart\u open/smart\u open\u lib.py”,第558行,在文件\u smart\u open中
返回打开(fname,模式)
FileNotFoundError:[Errno 2]没有这样的文件或目录:“vectors.bin”
我如何纠正这一点。在哪里可以获取vector.bin文件。 提前感谢您的帮助。

在描述如何加载由原始Google发布的word2vec.c工具包创建的向量时,使用了名称
vectors.bin
。(这是该工具包文档中使用的名称。)

除非您有这样一个文件并且需要对其进行处理,否则您不需要加载它

在描述如何加载由原始Google发布的word2vec.c工具包创建的向量时,使用名称
vectors.bin
。(这是该工具包文档中使用的名称。)


除非您有这样一个文件并且需要对其进行处理,否则您不需要加载它

有人能回答这个问题吗谢谢有人能回答这个问题谢谢