Skip to content

Commit

Permalink
Simplified expressions in WmdSimilarity and SoftCosineSimilarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jan 28, 2018
1 parent e1eb7cd commit 03a967b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gensim/similarities/docsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 03a967b

Please sign in to comment.