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
.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With