【发布时间】:2019-01-04 22:34:22
【问题描述】:
我正在处理叠放代码以比较近似重复项。我有点卡在比较代码上。这是我迄今为止的粗略尝试。
//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 还是应该将一个带状疱疹与循环中的所有带状疱疹进行比较,我有点犹豫。
例如,如果我循环比较每个带状疱疹和每个其他带状疱疹,那么这些文档将是相同的......
{blah blah blah, Once upon a, time blah blah}
{Once upon a, time blah blah, blah blah blah}
如果我对同一个文档进行位置比较,那么位置 1 将是“blah blah blah”与“Once on a”相比,这将返回 false。
我认为循环会更加密集,但它可能是正确的选择。想法?
【问题讨论】:
标签: java duplicates bigdata data-mining shingles