Skip to content

Commit

Permalink
Improved comments.
Browse files Browse the repository at this point in the history
Co-authored-by: Radim Řehůřek <me@radimrehurek.com>
  • Loading branch information
M-Demay and piskvorky authored May 25, 2021
1 parent 91d5dca commit 97e687e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gensim/models/word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ def predict_output_word(self, context_words_list, topn=10):
raise RuntimeError("Parameters required for predicting the output words not found.")

if all(isinstance(w, int) for w in context_words_list):
# then, indices were passed. Check they are valid
# Integer indices were passed. Check that they are all valid.
word2_indices = np.array(context_words_list)
if np.any(word2_indices < 0):
logger.warning("All input context word indices must be non-negative.")
Expand All @@ -1832,7 +1832,7 @@ def predict_output_word(self, context_words_list, topn=10):
logger.warning("All the input context words are out-of-vocabulary for the current model.")
return None
else:
# then, words were passed. Retrieve their indices
# Words (strings) were passed. Retrieve their indices.
word2_indices = [self.wv.get_index(w) for w in context_words_list if w in self.wv]
if not word2_indices:
logger.warning("All the input context words are out-of-vocabulary for the current model.")
Expand Down

0 comments on commit 97e687e

Please sign in to comment.