From 4b3e5c02a14c2ef261cc0ca5498b207bf685a75e Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Mon, 31 Dec 2018 16:19:28 +0100 Subject: [PATCH] Refactor feature computation in StandardReconConfig --- .../model/recon/StandardReconConfig.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/main/src/com/google/refine/model/recon/StandardReconConfig.java b/main/src/com/google/refine/model/recon/StandardReconConfig.java index 34981f0a5..ffbfedf2c 100644 --- a/main/src/com/google/refine/model/recon/StandardReconConfig.java +++ b/main/src/com/google/refine/model/recon/StandardReconConfig.java @@ -542,8 +542,20 @@ public class StandardReconConfig extends ReconConfig { recon.addCandidate(candidate); count++; } - - if (count > 0) { + + computeFeatures(recon, text); + return recon; + } + + /** + * Recomputes the features associated with this reconciliation + * object (only if we have at least one candidate). + * + * @param text + * the cell value to compare the reconciliation data to + */ + public void computeFeatures(Recon recon, String text) { + if (!recon.candidates.isEmpty()) { ReconCandidate candidate = recon.candidates.get(0); recon.setFeature(Recon.Feature_nameMatch, text.equalsIgnoreCase(candidate.name)); @@ -561,8 +573,7 @@ public class StandardReconConfig extends ReconConfig { } } } - return recon; - } + } static protected double wordDistance(String s1, String s2) { Set words1 = breakWords(s1);