Skip to content

Commit

Permalink
Fix bug in LsiModel that occurs when id2word is a Python 3 dictionary. (
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Van Gysel authored and tmylk committed Jan 24, 2017
1 parent c151486 commit e411433
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gensim/models/lsimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def __init__(self, corpus=None, num_topics=200, id2word=None, chunksize=20000,
self.id2word = utils.dict_from_corpus(corpus)
self.num_terms = len(self.id2word)
else:
self.num_terms = 1 + max([-1] + self.id2word.keys())
self.num_terms = 1 + (max(self.id2word.keys()) if self.id2word else -1)

self.docs_processed = 0
self.projection = Projection(self.num_terms, self.num_topics, power_iters=self.power_iters, extra_dims=self.extra_samples)
Expand Down

0 comments on commit e411433

Please sign in to comment.