Shingling算法-简单说
生活随笔
收集整理的這篇文章主要介紹了
Shingling算法-简单说
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
什么是Shingling算法
shingling算法用于計算兩個文檔的相似度,例如,用于網頁去重。維基百科對w-shingling的定義如下:
In natural language processing a w-shingling is a set of unique "shingles"—contiguous subsequences of tokens in a document —that can be used to gauge the similarity of two documents. The?w?denotes the number of tokens in each shingle in the set.維基百科用一個淺顯的例子講解了shingling算法的原理。比如,一個文檔
"a rose is a rose is a rose"分詞后的詞匯(token,語匯單元)集合是
(a,rose,is,a,rose,is, a, rose)那么w=4的4-shingling就是集合:
{ (a,rose,is,a), (rose,is,a,rose), (is,a,rose,is), (a,rose,is,a), (rose,is,a,rose) }去掉重復的子集合:
{ (a,rose,is,a), (rose,is,a,rose), (is,a,rose,is) }給定shingle的大小,兩個文檔A和B的相似度 r 定義為:
r(A,B)=|S(A)∩S(B)| / |S(A)∪S(B)|其中|A|表示集合A的大小。
因此,相似度是介于0和1之間的一個數值,且r(A,A)=1,即一個文檔和它自身 100%相似。
總結
以上是生活随笔為你收集整理的Shingling算法-简单说的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: yum下载软件包报错 you could
- 下一篇: ppt复现CVPR顶会流程图