I trained a doc2vec (gensim.models.Doc2Vec) model and now I'm using this line:
print(dict([(model.index2word[i], similarity) for i, similarity in enumerate(model.similar_by_word('igdumd32.dll@0x', topn=False))])['igdumd64.dll@0x'])
but it yields this error: AttributeError: 'Doc2Vec' object has no attribute 'index2word'
I am using gensim 1.0.1
Can you help?
The index2word
list of word-vectors has moved to the wv
property of the model in recent gensim versions, so where you would say model.index2word
you must now use model.wv.index2word
.
(Note that this is still just word-vectors, which are only trained by the "DM" dm=1
Doc2Vec modes. Doc-vectors are in the model.docvecs
object, and you can see a list of the string tags to which doc-vectors may be associated in model.docvecs.offset2doctag
.)