Skip to content

Commit

Permalink
Allow pass empty dictionary to gensim.corpora.WikiCorpus. Fix #2052 (
Browse files Browse the repository at this point in the history
  • Loading branch information
steremma authored and menshikh-iv committed Jun 20, 2018
1 parent e455bc8 commit 309da79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gensim/corpora/wikicorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ def __init__(self, fname, processes=None, lemmatize=utils.has_pattern(), diction
self.token_min_len = token_min_len
self.token_max_len = token_max_len
self.lower = lower
self.dictionary = dictionary or Dictionary(self.get_texts())

if dictionary is None:
self.dictionary = Dictionary(self.get_texts())
else:
self.dictionary = dictionary

def get_texts(self):
"""Iterate over the dump, yielding list of tokens for each article.
Expand Down

0 comments on commit 309da79

Please sign in to comment.