2017-10-12 9 views

답변

0

gensim 또는 다른 도구를 사용하여 word2vec 모델을 만든 경우 확실하지 않지만 질문을 올바르게 이해하면 gensim을 사용하여 word2vec 모델을로드하고 싶습니다. 이것은 다음과 같은 방법으로 수행됩니다

import gensim 
w2v_file = codecs.open(WORD2VEC_PATH, encoding='utf-8') 
model = gensim.models.KeyedVectors.load_word2vec_format(w2v_file, binary=True) # or binary=False if the model is not compressed 

그러나 싶은 것은 순전히 gensim 여기 사용하여 처음부터 모델 (즉 원시 텍스트에서) word2vec 훈련하는 경우가 tutorial on how to train word2vec model using gensim이다.

+0

고마워,이게 내가 바라는거야. –

+0

w2v_file 샘플을 제공해 주시겠습니까? 아니면 해당 형식을 생성하도록 도와 주시겠습니까? 단어와 그 벡터가 공백으로 구분 된 줄에 있고 단어가 줄로 구분되어 있습니다. 고맙습니다. @sophros –

+0

다음 방법을 시도해 보셨습니까? 'from gensim.models import word2vec model = word2vec.Word2Vec.load_word2vec_format ('path/to/GoogleNews-vectors-negative300.bin', binary = False) ' 중요한 부분은'binary = False'입니다. – sophros