既然你还没能真正演示出晶体输出,那么我最好的办法是:list_A = ['email','user','this','email','address','customer']
list_B = ['email','mail','address','netmail']
在上面两个列表中,我们将找到列表中每个元素与其余元素之间的余弦相似性。i、 e.email来自list_B,其中list_A中的每个元素:
^{pr2}$
输出:The cosine similarity between : email and : email is: 100.0
The cosine similarity between : mail and : email is: 89.44271909999159
The cosine similarity between : address and : email is: 26.967994498529684
The cosine similarity between : netmail and : email is: 84.51542547285166
The cosine similarity between : email and : user is: 22.360679774997898
The cosine similarity between : mail and : user is: 0.0
The cosine similarity between : address and : user is: 60.30226891555272
The cosine similarity between : netmail