Skip to content

Commit

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

* 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 Pranaydeep Singh committed Mar 21, 2017
1 parent 3f01c32 commit 834c078
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 834c078

Please sign in to comment.