Gensim Dimensions KeydVectors
Im the gensims
latest version, loading trainable vectors from file is done with KeyedVectors
, and dosent requires instantiating a new Word2Vec object. But now my code is corrupted because I cannot use the property model.vector_size
. What is the alternative to this? I mean something better than simple kv[kv.index2word[0]].size
.
source to share
kv.vector_size
still works; I am using gensim 2.3.0 which is the latest as I write. (I assume that kv
is your object KeyedVectors
.) It looks like the properties of the object are not documented in the API page, but autocomplete suggests this, and there is no deprecated warning or anything.
Your question helped me answer my questions, namely how to get the word count: len(kv.index2word)
source to share