diff --git a/library/ambiguity.dic b/library/ambiguity.dic index 00ba82ba..5411cc1a 100644 --- a/library/ambiguity.dic +++ b/library/ambiguity.dic @@ -5,4 +5,7 @@ 大 a 和尚 n 张三 nr 和 c 动漫 n 游戏 n -邓颖超 nr 生前 t \ No newline at end of file +邓颖超 nr 生前 t + + + diff --git a/plugin/ansj_lucene5_plugin/src/test/java/org/ansj/ansj_lucene5_plug/TestToken.java b/plugin/ansj_lucene5_plugin/src/test/java/org/ansj/ansj_lucene5_plug/TestToken.java index 69d99f72..67b2104e 100644 --- a/plugin/ansj_lucene5_plugin/src/test/java/org/ansj/ansj_lucene5_plug/TestToken.java +++ b/plugin/ansj_lucene5_plugin/src/test/java/org/ansj/ansj_lucene5_plug/TestToken.java @@ -26,7 +26,7 @@ public static void main(String[] args) { Map map = new HashMap(); - map.put("type", TYPE.index.name()); + map.put("type", "dic_ansj"); map.put(SynonymsLibrary.DEFAULT, SynonymsLibrary.DEFAULT); diff --git a/pom.xml b/pom.xml index 2a31ae46..2e4f6b13 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ ansj_seg jar ansj_seg - 5.1.0 + 5.1.1 best java chinese word seg ! https://github.com/NLPchina/ansj_seg diff --git a/src/main/java/org/ansj/library/AmbiguityLibrary.java b/src/main/java/org/ansj/library/AmbiguityLibrary.java index 3ef2ad36..56d0f7a7 100644 --- a/src/main/java/org/ansj/library/AmbiguityLibrary.java +++ b/src/main/java/org/ansj/library/AmbiguityLibrary.java @@ -180,7 +180,10 @@ public static KV remove(String key) { * @return */ public static void reload(String key) { - AMBIGUITY.get(key).setV(null); + KV kv = AMBIGUITY.get(key); + if (kv != null) { + AMBIGUITY.get(key).setV(null); + } get(key); } diff --git a/src/main/java/org/ansj/library/CrfLibrary.java b/src/main/java/org/ansj/library/CrfLibrary.java index 064fcf6f..0bb079bb 100644 --- a/src/main/java/org/ansj/library/CrfLibrary.java +++ b/src/main/java/org/ansj/library/CrfLibrary.java @@ -3,8 +3,8 @@ import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import org.ansj.app.crf.Model; import org.ansj.app.crf.SplitWord; @@ -123,8 +123,10 @@ public static KV remove(String key) { * @return */ public static void reload(String key) { - - CRF.get(key).setV(null); + KV kv = CRF.get(key); + if (kv != null) { + CRF.get(key).setV(null); + } get(key); } diff --git a/src/main/java/org/ansj/library/DicLibrary.java b/src/main/java/org/ansj/library/DicLibrary.java index 7e8dc1aa..f5b6dcc6 100644 --- a/src/main/java/org/ansj/library/DicLibrary.java +++ b/src/main/java/org/ansj/library/DicLibrary.java @@ -254,7 +254,10 @@ public static Set keys() { } public static void reload(String key) { - DIC.get(key).setV(null); + KV kv = DIC.get(key); + if (kv != null) { + DIC.get(key).setV(null); + } get(key); } diff --git a/src/main/java/org/ansj/library/StopLibrary.java b/src/main/java/org/ansj/library/StopLibrary.java index db6966a3..ee0d0a95 100644 --- a/src/main/java/org/ansj/library/StopLibrary.java +++ b/src/main/java/org/ansj/library/StopLibrary.java @@ -231,7 +231,10 @@ public static Set keys() { } public static void reload(String key) { - STOP.get(key).setV(null); + KV kv = STOP.get(key); + if (kv != null) { + STOP.get(key).setV(null); + } get(key); } diff --git a/src/main/java/org/ansj/library/SynonymsLibrary.java b/src/main/java/org/ansj/library/SynonymsLibrary.java index 55bfd2f3..2587ab6c 100644 --- a/src/main/java/org/ansj/library/SynonymsLibrary.java +++ b/src/main/java/org/ansj/library/SynonymsLibrary.java @@ -146,8 +146,10 @@ public static KV>> remove(String key) { * @return */ public static void reload(String key) { - - SYNONYMS.get(key).setV(null); + KV>> kv = SYNONYMS.get(key); + if (kv != null) { + SYNONYMS.get(key).setV(null); + } get(key); }