Skip to content

Commit

Permalink
Avoid sparse term similarity matrix computation when nonzero_limit <= 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed May 26, 2020
1 parent 2368932 commit be3a0b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gensim/similarities/termsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ def progress_bar(iterable):
row_buffer.append(column_number)
data_buffer.append(1.0)

if nonzero_limit <= 0:
continue

t1 = dictionary[t1_index]
num_nonzero = column_nonzero[t1_index]
num_rows = nonzero_limit - num_nonzero
Expand Down

0 comments on commit be3a0b8

Please sign in to comment.