There is a variable tfidf that contains numbers in this format: [(0, -0.34657359027997264), (1, -0.34657359027997264), (2, -0.34657359027997264), (3, -0.34657359027997264), (4, -0.34657359027997264), (5, -1.0986122886681098)...] When loading the cosine similarities code from gensim import similarities cos_sim = similarities.MatrixSimilarity(tfidf[bows]) The following error appears: TypeError: unhashable type: 'list'. Fix this error
import numpy as np tfidf = np.array(tfidf) from gensim import similarities cos_sim = similarities.MatrixSimilarity(tfidf[bows])