Beispiel #1
0
 private static double[] compareFieldSet(String[] fields, BibEntry one, BibEntry two) {
   double res = 0;
   double totWeights = 0.;
   for (String field : fields) {
     double weight;
     if (DuplicateCheck.FIELD_WEIGHTS.containsKey(field)) {
       weight = DuplicateCheck.FIELD_WEIGHTS.get(field);
     } else {
       weight = 1.0;
     }
     totWeights += weight;
     int result = DuplicateCheck.compareSingleField(field, one, two);
     if (result == EQUAL) {
       res += weight;
     } else if (result == EMPTY_IN_BOTH) {
       totWeights -= weight;
     }
   }
   if (totWeights > 0) {
     return new double[] {res / totWeights, totWeights};
   }
   return new double[] {0.5, 0.0};
 }
Beispiel #2
0
 static {
   DuplicateCheck.FIELD_WEIGHTS.put("author", 2.5);
   DuplicateCheck.FIELD_WEIGHTS.put("editor", 2.5);
   DuplicateCheck.FIELD_WEIGHTS.put("title", 3.);
   DuplicateCheck.FIELD_WEIGHTS.put("journal", 2.);
 }