Skip to content

Commit 7ede0ea

Browse files
Made keywords serializable by changing the keyword matrix to float64
1 parent ba88cb3 commit 7ede0ea

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

turftopic/models/_keynmf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ def batch_extract_keywords(
128128
self.term_embeddings[self.key_to_index[term]]
129129
for term in batch_vocab[important_terms]
130130
]
131-
sim = cosine_similarity(embedding, word_embeddings)
131+
sim = cosine_similarity(embedding, word_embeddings).astype(
132+
np.float64
133+
)
132134
sim = np.ravel(sim)
133135
kth = min(self.top_n, len(sim) - 1)
134136
top = np.argpartition(-sim, kth)[:kth]

0 commit comments

Comments
 (0)