Im gensims
latest version, loading trained vectors from a file is done using KeyedVectors
, and dosent requires instantiating a new Word2Vec object. But now my code is broken because I can't use the model.vector_size
property. What is the alternative to that? I mean something better than just kv[kv.index2word[0]].size
.
Asked
Active
Viewed 4,617 times
6

proton
- 393
- 6
- 31
1 Answers
8
kv.vector_size
still works; I'm using gensim 2.3.0, which is the latest as I write. (I am assuming kv
is your KeyedVectors
object.) It appears object properties are not documented on the API page, but auto-complete suggests it, and there is no deprecated warning or anything.
Your question helped me answer my own, which was how to get the number of words: len(kv.index2word)

Darren Cook
- 27,837
- 13
- 117
- 217