2017-01-17 1 views
1

나는 약 Word2Vec장갑 내가 GENSIM 사용할 수 here를 시작하는이를 통해 갈거야, 그래서 파이썬에서 모델을 배우고 있습니다. 내가 Idle3 단계로이 코드 단계를 컴파일 한 후Gensim는 오류가 시작되지하기 : 그런 파일이나 디렉토리 'vectors.bin'

:이를 해결하려면 어떻게

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' 

:

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) 

는이 오류를 얻고있다. 어디에서 vector.bin 파일을 얻을 수 있습니까? 미리 도움을 주셔서 감사합니다.

+0

이 질문에 답해주세요. –

답변

1

tutorial you link은 원래 Google에서 출시 한 word2vec.c 툴킷으로 만든 벡터를로드하는 방법을 설명 할 때 예를 들어 vectors.bin이라는 이름을 사용합니다. (그 툴킷의 문서에 사용 된 이름입니다.)

파일을 가지고 있고 그것으로 무언가를 할 필요가 없다면,로드 할 필요가 없습니다.

관련 문제