DEV Community

qiumingming7@gmail.com
qiumingming7@gmail.com

Posted on

Answer: gensim word2vec: Find number of words in vocabulary

The vocabulary is in the vocab field of the Word2Vec model's wv property, as a dictionary, with the keys being each token (word). So it's just the usual Python for getting a dictionary's length:

len(w2v_model.wv.vocab)

(In older gensim versions before 0.13, vocab appeared directly on the model. So you would…

Top comments (0)