From 50b7a12b3f4cc737203396bd1ed940c56816f3d5 Mon Sep 17 00:00:00 2001 From: miconis Date: Tue, 8 Oct 2019 15:13:45 +0200 Subject: [PATCH] normalization of the term in the translation map added --- .../main/java/eu/dnetlib/pace/config/PaceConfig.java | 5 ++++- .../test/java/eu/dnetlib/pace/config/ConfigTest.java | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dnet-pace-core/src/main/java/eu/dnetlib/pace/config/PaceConfig.java b/dnet-pace-core/src/main/java/eu/dnetlib/pace/config/PaceConfig.java index 490fbafc4..939f6c037 100644 --- a/dnet-pace-core/src/main/java/eu/dnetlib/pace/config/PaceConfig.java +++ b/dnet-pace-core/src/main/java/eu/dnetlib/pace/config/PaceConfig.java @@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils; import org.codehaus.jackson.annotate.JsonIgnore; import java.io.Serializable; +import java.text.Normalizer; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -46,7 +47,9 @@ public class PaceConfig implements Serializable { translationMap = Maps.newHashMap(); for (String key : synonyms.keySet()) { for (String term : synonyms.get(key)){ - translationMap.put(term.toLowerCase(), key); + translationMap.put( + Normalizer.normalize(term.toLowerCase(), Normalizer.Form.NFD), + key); } } } diff --git a/dnet-pace-core/src/test/java/eu/dnetlib/pace/config/ConfigTest.java b/dnet-pace-core/src/test/java/eu/dnetlib/pace/config/ConfigTest.java index 575b3c786..fd16f7390 100644 --- a/dnet-pace-core/src/test/java/eu/dnetlib/pace/config/ConfigTest.java +++ b/dnet-pace-core/src/test/java/eu/dnetlib/pace/config/ConfigTest.java @@ -10,7 +10,7 @@ public class ConfigTest extends AbstractPaceTest { @Test public void dedupConfigSerializationTest() { - final DedupConfig cfgFromClasspath = DedupConfig.load(readFromClasspath("result.pace.conf.json")); + final DedupConfig cfgFromClasspath = DedupConfig.load(readFromClasspath("org.curr.conf")); final String conf = cfgFromClasspath.toString(); @@ -37,4 +37,12 @@ public class ConfigTest extends AbstractPaceTest { System.out.println(load.toString()); } + @Test + public void translationMapTest() { + + DedupConfig load = DedupConfig.load(readFromClasspath("org.curr.conf")); + + System.out.println("translationMap = " + load.getPace().translationMap().toString()); + } + }