From 27e76b8324faf8612d80c6c94e811e59efe16797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Novotn=C3=BD?= Date: Thu, 5 Apr 2018 08:43:01 +0200 Subject: [PATCH] Replace scipy.sparse.dok_matrix.has_key with the in operator --- gensim/models/term_similarity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gensim/models/term_similarity.py b/gensim/models/term_similarity.py index b3a0f6868d..527ca69379 100644 --- a/gensim/models/term_similarity.py +++ b/gensim/models/term_similarity.py @@ -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: