Skip to content

Commit

Permalink
Replace scipy.sparse.dok_matrix.has_key with the in operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Apr 5, 2018
1 parent 7274fac commit 27e76b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gensim/models/term_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __init__(self, source, dictionary=None, tfidf=None, symmetric=True, nonzero_
continue
t2_index = dictionary.token2id[t2]
if (not symmetric or matrix_nonzero[t2_index] <= nonzero_limit):
if not matrix.has_key((t1_index, t2_index)):
if not (t1_index, t2_index) in matrix:
matrix[t1_index, t2_index] = similarity
matrix_nonzero[t1_index] += 1
if symmetric:
Expand Down

0 comments on commit 27e76b8

Please sign in to comment.