-
-
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
PEP8 fixes for corpora #1001
PEP8 fixes for corpora #1001
Conversation
@@ -119,7 +119,7 @@ def line2doc(self, line): | |||
marker.add(word) | |||
# construct a list of (wordIndex, wordFrequency) 2-tuples | |||
doc = list(zip(map(self.word2id.get, use_words), | |||
map(words.count, use_words))) | |||
map(words.count, use_words))) |
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 vertical indent in gensim; use hanging indent in all cases (& no statement on first line).
@@ -166,8 +166,8 @@ def save_corpus(fname, corpus, id2word=None, metadata=False): | |||
|
|||
if truncated: | |||
logger.warning("List-of-words format can only save vectors with " | |||
"integer elements; %i float entries were truncated to integer value" % | |||
truncated) | |||
"integer elements; %i float entries were truncated to integer value" % |
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.
Dtto (please use hanging indent consistently).
Also, we want to be passing logging message string parameters as arguments, not using them to format the string directly (wasted effort if message doesn't pass logging filters): logger.fnc("%s", x)
, not logger.fnc("%s" % x)
.
@@ -236,7 +236,7 @@ def __init__(self, output_prefix, corpus, dim=None, | |||
# corresponds to index 0 of current shard | |||
|
|||
logger.info('Initializing sharded corpus with prefix ' | |||
'{0}'.format(output_prefix)) |
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.
Hanging indent.
@@ -245,7 +245,7 @@ def __init__(self, output_prefix, corpus, dim=None, | |||
# and retain information about how the corpus | |||
# was serialized. | |||
logger.info('Saving ShardedCorpus object to ' | |||
'{0}'.format(self.output_prefix)) | |||
'{0}'.format(self.output_prefix)) |
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.
Hanging indent.
@@ -262,12 +262,12 @@ def init_shards(self, output_prefix, corpus, shardsize=4096, dtype=_default_dtyp | |||
if proposed_dim != self.dim: | |||
if self.dim is None: | |||
logger.info('Deriving dataset dimension from corpus: ' | |||
'{0}'.format(proposed_dim)) | |||
'{0}'.format(proposed_dim)) |
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.
Hanging indent. Last comment -- please fix all.
What's happening with these pull request? I write a review and then they disappear again, closed without merging or any message...? |
Sorry for closing this PR. I was trying to create separate PR for corpora and topic_coherence in different branches, but somehow the changes for both corpora and topic_coherence got into the PR #1002 |
My review comments here stand; please address them in the other PRs. |
Fixes a small part of #965