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

model does not build new vocabularies after add_keyword_corpus() #29

Open
hannahxchen opened this issue Dec 1, 2018 · 0 comments
Open

Comments

@hannahxchen
Copy link
Contributor

The model does not build new vocabs for new input words from add_keyword_corpus. The model would only build_vocab() during initialization (inside mixin class) and during training (if train_embed() has input sentences or keywords).

from embedding import SecWord2Vec

keywords = ['hello', 'cat']
sentences = ['hello world test', 'this is a cat']

model = SecWord2Vec(keywords, sentences, min_count=1, size=10)
print('After initialized:')
print('vocabs: {}'.format(model.wv.vocab.keys()))

model.add_keyword_corpus('dog', ['that is a dog', 'cats are adorable'])
print('\nAfter adding new keyword corpus:')
print('vocabs: {}'.format(model.wv.vocab.keys()))

model.train_embed()
print('\nAfter training:')
print('vocabs: {}'.format(model.wv.vocab.keys()))

screen shot 2018-12-01 at 7 47 14 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant