Skip to content

Commit

Permalink
Fix #824 : no corpus in init, but trim_rule in init (#1186)
Browse files Browse the repository at this point in the history
* no corpus in init, but trim_rule in init

logged warning that trim_rule is being ignored for separate model initialization and vocabulary building

* log warning only when trim_rule is specified
  • Loading branch information
prakhar2b authored and tmylk committed Mar 7, 2017
1 parent 51bb15b commit 000c02a
Showing 1 changed file with 6 additions and 0 deletions.
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 :
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

0 comments on commit 000c02a

Please sign in to comment.