notebook In [21]:
def get_word_vec_similarity(node1, node2, node_ls):
node1_vec = [tup[4] for tup in node_ls if tup[0] == node1]
node2_vec = [tup[4] for tup in node_ls if tup[0] == node2]
if node1_vec and node2_vec:
return cosine_similarity(node1_vec, node2_vec)
return 'one or both terms not found'
notebook In [21]: def get_word_vec_similarity(node1, node2, node_ls):
node1_vec = [tup[4] for tup in node_ls if tup[0] == node1] node2_vec = [tup[4] for tup in node_ls if tup[0] == node2] if node1_vec and node2_vec: return cosine_similarity(node1_vec, node2_vec) return 'one or both terms not found'