From 309da79584440b0ca87130393f8f85a261b38365 Mon Sep 17 00:00:00 2001 From: Stergiadis Manos Date: Wed, 20 Jun 2018 13:17:49 +0200 Subject: [PATCH] Allow pass empty dictionary to `gensim.corpora.WikiCorpus`. Fix #2052 (#2042) --- gensim/corpora/wikicorpus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gensim/corpora/wikicorpus.py b/gensim/corpora/wikicorpus.py index b7a18f02db..1c088b9416 100644 --- a/gensim/corpora/wikicorpus.py +++ b/gensim/corpora/wikicorpus.py @@ -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.