文本相似度计算

http://www.sohu.com/a/220353074_744545

编辑距离相似度:Edit Distance Similarity

编辑距离的作用主要是用来比较两个字符串的相似度的。

编辑操作只有三种:插入,删除,替换。对两个字符串,将其中一个字符串经过上面的这三种操作之后,得和另外一个完全相同的字符串付出的代价就是编辑距离

例如: 如果str1=”html”,str2=”htm”,那么str1删除最后的“l”就等于str2,所以编辑距离是1。相似度 = 1 - (1 / Math.Max(str1.length, str2.length) )= 0.75

算法: 动态规划的思路。 https://www.cnblogs.com/sumuncle/p/5632032.html   https://blog.csdn.net/chichoxian/article/details/53944188  http://www.sohu.com/a/220353074_744545

Jaccard相似度: Jaccard Similarity

Jaccard Similarity是两个集合的交集除以两个集合的并集所得。

算法: https://blog.csdn.net/ygrx/article/details/12748857  http://www.sohu.com/a/220353074_744545

Cosine相似度:CosineSimilarity

算法:http://www.sohu.com/a/220353074_744545

BM25相似度: BM25Similarity

算法:https://www.jianshu.com/p/1e498888f505  https://www.cnblogs.com/DjangoBlog/p/5193550.html

 ANNOY:

语义向量相似度检索。

算法:通过递归的2类别聚类,构建一个检索树。

https://blog.csdn.net/hero_fantao/article/details/70245387  https://www.cnblogs.com/futurehau/p/6524396.html  https://github.com/spotify/annoy

 

原文地址:https://www.cnblogs.com/activeshj/p/9544496.html