比较带状疱疹以进行近似重复检测

Comparing Shingles for Near-Duplicate Detection

我正在研究叠叠代码以比较近似重复项。我有点卡在比较代码上了。到目前为止,这是我的粗略尝试。

//shingles are already hashed integers and I'm working on the evaluation to true via the float similar parameter.
public static boolean compareShingles(float similar, CompareObject comp1, CompareObject comp2) {
        int intersections = 0;
        if(comp1.getShingle().size()>=comp2.getShingle().size()){
        for(int i = 0; i < comp1.getShingle().size(); i++){

              if(comp1.getShingle().get(i).equals(comp2.getShingle().get(i))){
              intersections++;
              }

        }
        }
        else{
              for(int i = 0; i < comp2.getShingle().size(); i++){
                    if(comp2.getShingle().get(i).equals(comp1.getShingle().get(i))){
                    intersections++;
                    }

              }
        }
        return true; //not functional still working on when to return true
  }

如果我应该比较数组中的这些带状疱疹 1-1,或者我是否应该将一个带状疱疹与循环中的所有带状疱疹进行比较,我有点犹豫不决。

例如,如果我将每个 shingle 与其他每个 shingle 进行循环比较,那么这些文档将是相同的...

{blah blah blah, Once upon a, time blah blah}
{Once upon a, time blah blah, blah blah blah}

如果我对相同的文档进行位置比较,那么位置 1 将是 "blah blah blah" 与 "Once upon a" 相比,那将是 return 错误。

我认为循环会更加密集,但这可能是正确的选择。想法?

顺序无关紧要..

您基本上制作了叠瓦集并将它们与 Jaccard Similarity 进行比较。它有助于有一个散列来自动丢弃重复的带状疱疹。只需计算每个文档之间的匹配项,并计算出需要匹配多少个文档才能认为它们相似。

http://ethen8181.github.io/machine-learning/clustering_old/text_similarity/text_similarity.html