#The text file must be in utf-8 without bom format from gensim.models.deprecated.word2vec import Word2Vec model = Word2Vec.load( ' ./model/Word60.model ' ) # 3 files together: Word60.model Word60.model.syn0.npy Word60.model.syn1neg.npy print ( " read model successful " ) word_list = [ ' had ' , ' non-existent word ' , ' of ' , ' me ' , ' you ' , ' he ' , ' one ' , ' 1 ' , ' done ' , ' eat ' , ' apple ' , 'banana ', ' Vocabulary ' , ' Physics ' , ' Earth ' , ' Black Death ' , ' Plague ' , '' , ] for word in word_list: if word in model.index2word: vec = model[word] print (word,vec) else : print (word + ' \t\t\t - not in vocabulary ' + ' \n\n ' )
The model file is as follows: