I have already trained a Word2Vec model with gensim.models.Word2Vec. by which means can I acquire the frequency of each word in this model?
Asked
Active
Viewed 3,438 times
3
-
Possible duplicate of [How to get vocabulary word count from gensim word2vec?](https://stackoverflow.com/questions/37190989/how-to-get-vocabulary-word-count-from-gensim-word2vec) – Philip Mar 16 '18 at 11:31
-
1Why did you accept the answer? Those are not the real counts. Those counts are generated by gensim and they are the positions of words not their frequency. – ozgur Dec 23 '18 at 18:17
1 Answers
5
model = gensim.models.Word2Vec.load('Word2VecModel/word2vec')
for w in model.vocab:
print (w, model.vocab[w].count)

Ian
- 3,605
- 4
- 31
- 66

Liaoxiaochen
- 139
- 2
- 11
-
4My model says I have 5,339 words. The count output for each word decreases by 1 from 5,339 to 1. `count` is a tracker, not the actual frequency. – brienna Apr 22 '18 at 23:08
-
@briennakh True. Mine starts with 3000000 and goes down 1 by 1. Cannot be true. – ozgur Dec 23 '18 at 17:37