From 635bb1fd136baf55cac1e06e24303f0832943052 Mon Sep 17 00:00:00 2001 From: Julian Zell Date: Fri, 18 Sep 2015 02:35:28 +0200 Subject: [PATCH] bugfix for WebUI use of multiple WILDCARD languages --- .../dbs/uima/annotator/heideltime/resources/Language.java | 5 +++++ .../heideltime/resources/NormalizationManager.java | 6 +++--- .../annotator/heideltime/resources/RePatternManager.java | 6 +++--- .../uima/annotator/heideltime/resources/RuleManager.java | 6 +++--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/de/unihd/dbs/uima/annotator/heideltime/resources/Language.java b/src/de/unihd/dbs/uima/annotator/heideltime/resources/Language.java index 58072633..79f9c6c2 100644 --- a/src/de/unihd/dbs/uima/annotator/heideltime/resources/Language.java +++ b/src/de/unihd/dbs/uima/annotator/heideltime/resources/Language.java @@ -98,4 +98,9 @@ public final String getTreeTaggerLangName() { public final String getResourceFolder() { return this.resourceFolder; } + + @Override + public String toString() { + return getName(); + } } \ No newline at end of file diff --git a/src/de/unihd/dbs/uima/annotator/heideltime/resources/NormalizationManager.java b/src/de/unihd/dbs/uima/annotator/heideltime/resources/NormalizationManager.java index d808943c..505ad500 100644 --- a/src/de/unihd/dbs/uima/annotator/heideltime/resources/NormalizationManager.java +++ b/src/de/unihd/dbs/uima/annotator/heideltime/resources/NormalizationManager.java @@ -18,7 +18,7 @@ * */ public class NormalizationManager extends GenericResourceManager { - protected static HashMap instances = new HashMap(); + protected static HashMap instances = new HashMap(); // PATTERNS TO READ RESOURCES "RULES" AND "NORMALIZATION" private Pattern paReadNormalizations = Pattern.compile("\"(.*?)\",\"(.*?)\""); @@ -73,10 +73,10 @@ private NormalizationManager(String language) { public static NormalizationManager getInstance(Language language) { if(!instances.containsKey(language)) { NormalizationManager nm = new NormalizationManager(language.getResourceFolder()); - instances.put(language, nm); + instances.put(language.getName(), nm); } - return instances.get(language); + return instances.get(language.getName()); } /** diff --git a/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java b/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java index 467495ac..87608a98 100644 --- a/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java +++ b/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java @@ -20,7 +20,7 @@ * */ public class RePatternManager extends GenericResourceManager { - protected static HashMap instances = new HashMap(); + protected static HashMap instances = new HashMap(); // STORE PATTERNS AND NORMALIZATIONS private TreeMap hmAllRePattern; @@ -54,10 +54,10 @@ private RePatternManager(String language) { public static RePatternManager getInstance(Language language) { if(!instances.containsKey(language)) { RePatternManager nm = new RePatternManager(language.getResourceFolder()); - instances.put(language, nm); + instances.put(language.getName(), nm); } - return instances.get(language); + return instances.get(language.getName()); } diff --git a/src/de/unihd/dbs/uima/annotator/heideltime/resources/RuleManager.java b/src/de/unihd/dbs/uima/annotator/heideltime/resources/RuleManager.java index f4585126..98efb5e8 100644 --- a/src/de/unihd/dbs/uima/annotator/heideltime/resources/RuleManager.java +++ b/src/de/unihd/dbs/uima/annotator/heideltime/resources/RuleManager.java @@ -24,7 +24,7 @@ * */ public class RuleManager extends GenericResourceManager { - protected static HashMap instances = new HashMap(); + protected static HashMap instances = new HashMap(); // PATTERNS TO READ RESOURCES "RULES" AND "NORMALIZATION" Pattern paReadRules = Pattern.compile("RULENAME=\"(.*?)\",EXTRACTION=\"(.*?)\",NORM_VALUE=\"(.*?)\"(.*)"); @@ -104,10 +104,10 @@ protected RuleManager(String language) { public static RuleManager getInstance(Language language) { if(!instances.containsKey(language)) { RuleManager nm = new RuleManager(language.getResourceFolder()); - instances.put(language, nm); + instances.put(language.getName(), nm); } - return instances.get(language); + return instances.get(language.getName()); } /**