For relevance service, auto-match only if the type matches, the score is at least 100, and if there is more than one result, the ratio of the first result's score over the second result's score must be at least 1.5.

For recon service, auto-match only if the result has match:true.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@559 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-27 21:38:47 +00:00
parent 8651eaaafb
commit e77b99e58b

View File

@ -294,28 +294,33 @@ public class HeuristicReconConfig extends ReconConfig {
score score
); );
// best match
if (i == 0) {
recon.setFeature(Recon.Feature_nameMatch, text.equalsIgnoreCase(candidate.topicName));
recon.setFeature(Recon.Feature_nameLevenshtein, StringUtils.getLevenshteinDistance(text, candidate.topicName));
recon.setFeature(Recon.Feature_nameWordDistance, wordDistance(text, candidate.topicName));
recon.setFeature(Recon.Feature_typeMatch, false);
for (String typeID : candidate.typeIDs) {
if (this.typeID.equals(typeID)) {
recon.setFeature(Recon.Feature_typeMatch, true);
if (autoMatch && score >= 100) {
recon.match = candidate;
recon.judgment = Judgment.Matched;
}
break;
}
}
}
recon.addCandidate(candidate); recon.addCandidate(candidate);
count++; count++;
} }
if (count > 0) {
ReconCandidate candidate = recon.candidates.get(0);
recon.setFeature(Recon.Feature_nameMatch, text.equalsIgnoreCase(candidate.topicName));
recon.setFeature(Recon.Feature_nameLevenshtein, StringUtils.getLevenshteinDistance(text, candidate.topicName));
recon.setFeature(Recon.Feature_nameWordDistance, wordDistance(text, candidate.topicName));
recon.setFeature(Recon.Feature_typeMatch, false);
for (String typeID : candidate.typeIDs) {
if (this.typeID.equals(typeID)) {
recon.setFeature(Recon.Feature_typeMatch, true);
if (autoMatch && candidate.score >= 100) {
if (count == 1 ||
candidate.score / recon.candidates.get(1).score >= 1.5) {
recon.match = candidate;
recon.judgment = Judgment.Matched;
}
}
break;
}
}
}
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -401,9 +406,7 @@ public class HeuristicReconConfig extends ReconConfig {
for (String typeID : candidate.typeIDs) { for (String typeID : candidate.typeIDs) {
if (this.typeID.equals(typeID)) { if (this.typeID.equals(typeID)) {
recon.setFeature(Recon.Feature_typeMatch, true); recon.setFeature(Recon.Feature_typeMatch, true);
if (autoMatch && if (autoMatch && result.has("match") && result.getBoolean("match")) {
(score > 0.6 ||
(result.has("match") && result.getBoolean("match")))) {
recon.match = candidate; recon.match = candidate;
recon.judgment = Judgment.Matched; recon.judgment = Judgment.Matched;
} }