From 03a967b580e8c5f45a5cbe12ebabf75064ab0d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Novotn=C3=BD?= Date: Sun, 28 Jan 2018 19:29:16 +0100 Subject: [PATCH] Simplified expressions in WmdSimilarity and SoftCosineSimilarity --- gensim/similarities/docsim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gensim/similarities/docsim.py b/gensim/similarities/docsim.py index fd07160100..f3c706fe41 100755 --- a/gensim/similarities/docsim.py +++ b/gensim/similarities/docsim.py @@ -618,7 +618,7 @@ def __init__(self, corpus, similarity_matrix, num_best=None, chunksize=256): self.normalize = False # index is simply an array from 0 to size of corpus. - self.index = numpy.array(range(len(corpus))) + self.index = numpy.arange(len(corpus)) # Remove the columns of the similarity matrix that correspond to terms outside corpus. nonzero_columns = sorted(set((index for document in corpus for index, _ in document))) @@ -708,7 +708,7 @@ def __init__(self, corpus, w2v_model, num_best=None, normalize_w2v_and_replace=T self.normalize = False # index is simply an array from 0 to size of corpus. - self.index = numpy.array(range(len(corpus))) + self.index = numpy.arange(len(corpus)) if normalize_w2v_and_replace: # Normalize vectors in word2vec class to length 1.