您面临着一个在该领域已知的问题信息检索 http://en.wikipedia.org/wiki/Information_retrieval as 接近重复检测.
已知的解决方案之一是使用杰卡德相似性 http://en.wikipedia.org/wiki/Jaccard_index用于获取两个文档之间的差异。
Jaccard 相似度基本上是 - 从每个文档中获取单词集,让这些集合为s1
and s2
- 杰卡德相似度是|s1 [intersection] s2|/|s1 [union] s2|
.
通常,当面对接近的重复时,单词的顺序有一定的重要性。为了处理它 - 生成集合时s1
and s2
- 您实际上生成了 k-shingling 集合,而不是仅单词集合。
在你的例子中,与k=2
,集合将是:
s1 = { I'm write, write a, a crawler, crawler to }
s2 = { I'm write, write a, a some, some text, text crawler, crawler to, to get }
s1 [union] s2 = { I'm write, write a, a crawler, crawler to, a some, some text, text crawler, to get }
s1 [intersection] s2 = { I'm write, write a, crawler to }
在上面的例子中,jaccard 相似度为3/8
。如果您使用相同方法的单个单词(k=1 shinglings),您将得到您想要的5/8
- 但在我(和大多数 IR 专家)看来,这是更糟糕的解决方案。
这个过程可以很好地扩展,以非常有效地处理巨大的集合,而无需检查所有对并创建大量的集合。更多详细信息可以在这些讲义 http://webcourse.cs.technion.ac.il/236375/Winter2013-2014/ho/WCFiles/tutorial_8_near_duplicates_detection.pdf(我几个月前根据作者的笔记做了这个讲座)。