-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed wrapper tests #1323 #1359
Conversation
Thank you @shubhamjain74, It's a nice start 👍 |
@@ -281,6 +281,7 @@ def finalize_options(self): | |||
'scipy >= 0.7.0', | |||
'six >= 1.5.0', | |||
'smart_open >= 1.2.1', | |||
'morfessor==2.0.2alpha4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's dependency for VarEmbed
wrapper. Maybe need to create several mode for install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. See the optional extras_require
setup param.
@@ -190,7 +190,7 @@ def load_word_topics(self): | |||
if hasattr(self.id2word, 'token2id'): | |||
word2id = self.id2word.token2id | |||
else: | |||
word2id = dict((v, k) for k, v in iteritems(self.id2word)) | |||
word2id = dict((v, k) for k, v in iteritems(dict(self.id2word))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this dict
casting for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for python3 compatibility (if self.id2word is FakeDict
object, iteritems
can't work correctly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update utils.revdict
then, and use that consistently. There are probably more places like this in the code.
@@ -93,7 +93,7 @@ def __init__( | |||
lencorpus = sum(1 for _ in corpus) | |||
if lencorpus == 0: | |||
raise ValueError("cannot compute DTM over an empty corpus") | |||
if model == "fixed" and any([i == 0 for i in [len(text) for text in corpus.get_texts()]]): | |||
if model == "fixed" and any([i == 0 for i in [len(text) for text in corpus]]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the outer brackets [
and ]
(generator fine).
But the whole construction feels unpythonic and strange -- simple any(not text for text in corpus)
better?
No description provided.