From 97e687e2070a15b434b50b60c12f6dd31d3d6bfc Mon Sep 17 00:00:00 2001 From: M-Demay <55137190+M-Demay@users.noreply.github.com> Date: Tue, 25 May 2021 10:26:29 +0200 Subject: [PATCH] Improved comments. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Radim Řehůřek --- gensim/models/word2vec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gensim/models/word2vec.py b/gensim/models/word2vec.py index c363ac42fa..bd1a269752 100755 --- a/gensim/models/word2vec.py +++ b/gensim/models/word2vec.py @@ -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.") @@ -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.")