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

Fix #824 : no corpus in init, but trim_rule in init #1186

Merged
merged 2 commits into from
Mar 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gensim/models/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,12 @@ def __init__(
raise TypeError("You can't pass a generator as the sentences argument. Try an iterator.")
self.build_vocab(sentences, trim_rule=trim_rule)
self.train(sentences)

else :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning even shows if no trim_rule specified – which seems excessive, as there's no hint that the user is confused in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gojomo Thanks for pointing that out. I've updated the code accordingly.

if trim_rule is not None :
logger.warning("The rule, if given, is only used prune vocabulary during build_vocab() and is not stored as part of the model. ")
logger.warning("Model initialized without sentences. trim_rule provided, if any, will be ignored." )


def initialize_word_vectors(self):
self.wv = KeyedVectors()
Expand Down