Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LsiModel: Only log top words that actually exist in the dictionary (#…
…3091) * lsimodel: Only log top words that actually exist in <id2word> In some pathological cases, we might try to log the top N words, even though we haven't seen N words yet. In these cases, we can just exit the loop early. Closes #3090. * utils: Implement FakeDict::__contains__() In 8f8cb49, I added a check that checks val in self.id2word When testing, `id2word` is actually an instance of `FakeDict`, which doesn't implement `__contains__()` (so Python falls back to calling `__getitem__()`[1]). The tests didn't like this[2]. [1] https://docs.python.org/3.6/reference/datamodel.html#object.__contains__ [2] https://github.com/RaRe-Technologies/gensim/runs/2197137529 * Update lsimodel.py * Update CHANGELOG.md Co-authored-by: Michael Penkov <[email protected]>
- Loading branch information