Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document accessing the vocabulary of a *2vec model #2660

Closed
mpenkov opened this issue Oct 31, 2019 · 0 comments · Fixed by #2661
Closed

Document accessing the vocabulary of a *2vec model #2660

mpenkov opened this issue Oct 31, 2019 · 0 comments · Fixed by #2661
Assignees
Labels
documentation Current issue related to documentation

Comments

@mpenkov
Copy link
Collaborator

mpenkov commented Oct 31, 2019

@andreamoro like this:

from gensim.test.utils import common_texts
from gensim.models import Word2Vec

model = Word2Vec(common_texts, size=100, window=5, min_count=1, workers=4)
word_vectors = model.wv
print(list(word_vectors.vocab.keys()))

['minors', 'graph', 'system', 'trees', 'eps', 'computer', 'survey', 'user', 'human', 'time', 'interface', 'response']

Documentation of KeyedVectors = the class holding the trained word vectors.

@mpenkov listing the model vocab is a reasonable task, but I couldn't find it in our documentation either. I had to look at the source code. Maybe we can add it somewhere? API ref? Tutorial? @andreamoro where would you expect / look for this information?

Originally posted by @piskvorky in #2422 (comment)

@mpenkov mpenkov added the documentation Current issue related to documentation label Oct 31, 2019
@mpenkov mpenkov self-assigned this Oct 31, 2019
@piskvorky piskvorky changed the title Document accessing the vocabulary of a model Document accessing the vocabulary of a *2vec model Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Current issue related to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant