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:
parent
8651eaaafb
commit
e77b99e58b
@ -294,28 +294,33 @@ public class HeuristicReconConfig extends ReconConfig {
|
||||
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);
|
||||
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) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -401,9 +406,7 @@ public class HeuristicReconConfig extends ReconConfig {
|
||||
for (String typeID : candidate.typeIDs) {
|
||||
if (this.typeID.equals(typeID)) {
|
||||
recon.setFeature(Recon.Feature_typeMatch, true);
|
||||
if (autoMatch &&
|
||||
(score > 0.6 ||
|
||||
(result.has("match") && result.getBoolean("match")))) {
|
||||
if (autoMatch && result.has("match") && result.getBoolean("match")) {
|
||||
recon.match = candidate;
|
||||
recon.judgment = Judgment.Matched;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user