/** * Passes on all matches found. */ protected void compareCandidatesSimple(Record record, Collection<Record> candidates) { boolean found = false; for (Record candidate : candidates) { if (isSameAs(record, candidate)) continue; double prob = compare(record, candidate); if (prob > config.getThreshold()) { found = true; registerMatch(record, candidate, prob); } else if (config.getMaybeThreshold() != 0.0 && prob > config.getMaybeThreshold()) { found = true; // I guess? registerMatchPerhaps(record, candidate, prob); } } if (!found) registerNoMatchFor(record); }
/** * Passes on only the best match for each record. */ protected void compareCandidatesBest(Record record, Collection<Record> candidates) { double max = 0.0; Record best = null; // go through all candidates, and find the best for (Record candidate : candidates) { if (isSameAs(record, candidate)) continue; double prob = compare(record, candidate); if (prob > max) { max = prob; best = candidate; } } // pass on the best match, if any if (logger.isDebugEnabled()) { logger.debug("Best candidate at " + max + " is " + best); } if (max > config.getThreshold()) registerMatch(record, best, max); else if (config.getMaybeThreshold() != 0.0 && max > config.getMaybeThreshold()) registerMatchPerhaps(record, best, max); else registerNoMatchFor(record); }
/** * Passes on all matches found. */ protected void compareCandidatesSimple(Record record, Collection<Record> candidates) { boolean found = false; for (Record candidate : candidates) { if (isSameAs(record, candidate)) continue; double prob = compare(record, candidate); if (prob > config.getThreshold()) { found = true; registerMatch(record, candidate, prob); } else if (config.getMaybeThreshold() != 0.0 && prob > config.getMaybeThreshold()) { found = true; // I guess? registerMatchPerhaps(record, candidate, prob); } } if (!found) registerNoMatchFor(record); }
/** * Passes on only the best match for each record. */ protected void compareCandidatesBest(Record record, Collection<Record> candidates) { double max = 0.0; Record best = null; // go through all candidates, and find the best for (Record candidate : candidates) { if (isSameAs(record, candidate)) continue; double prob = compare(record, candidate); if (prob > max) { max = prob; best = candidate; } } // pass on the best match, if any if (max > config.getThreshold()) registerMatch(record, best, max); else if (config.getMaybeThreshold() != 0.0 && max > config.getMaybeThreshold()) registerMatchPerhaps(record, best, max); else registerNoMatchFor(record); }