From 9534a78b9621787cf139146c16331ee1155b1d16 Mon Sep 17 00:00:00 2001 From: piaolingxue Date: Mon, 2 Sep 2013 20:30:32 +0800 Subject: [PATCH 1/3] fix user dict load. --- conf/{jieba => }/sougou.dict | 0 conf/{jieba => }/user.dict | 1 + .../com/huaban/analysis/jieba/WordDictionary.java | 12 ++++++------ 3 files changed, 7 insertions(+), 6 deletions(-) rename conf/{jieba => }/sougou.dict (100%) rename conf/{jieba => }/user.dict (82%) diff --git a/conf/jieba/sougou.dict b/conf/sougou.dict similarity index 100% rename from conf/jieba/sougou.dict rename to conf/sougou.dict diff --git a/conf/jieba/user.dict b/conf/user.dict similarity index 82% rename from conf/jieba/user.dict rename to conf/user.dict index 1edf15a..62d4152 100644 --- a/conf/jieba/user.dict +++ b/conf/user.dict @@ -3,3 +3,4 @@ 显瘦 3 又拍云 3 iphone 3 +鲜芋仙 3 \ No newline at end of file diff --git a/src/main/java/com/huaban/analysis/jieba/WordDictionary.java b/src/main/java/com/huaban/analysis/jieba/WordDictionary.java index 1a8af18..bc329c9 100644 --- a/src/main/java/com/huaban/analysis/jieba/WordDictionary.java +++ b/src/main/java/com/huaban/analysis/jieba/WordDictionary.java @@ -16,8 +16,7 @@ public class WordDictionary { private static WordDictionary singleInstance; private static final String MAIN_DICT = "/dict.txt"; - private static String SOUGOU_DICT = "jieba/sougou.dict"; - private static String USER_DICT = "jieba/user.dict"; + private static String USER_DICT_SUFFIX = ".dict"; public final TrieNode trie = new TrieNode(); public final Map freqs = new HashMap(); @@ -42,10 +41,11 @@ public synchronized static WordDictionary getInstance() { */ public synchronized void init(File configFile) { if (!isLoaded) { - File sougouDict = new File(configFile, SOUGOU_DICT); - File userDict = new File(configFile, USER_DICT); - singleInstance.loadUserDict(sougouDict); - singleInstance.loadUserDict(userDict); + for (File userDict : configFile.listFiles()) { + if (userDict.getPath().endsWith(USER_DICT_SUFFIX)) { + singleInstance.loadUserDict(userDict); + } + } isLoaded = true; } } From 331cc94c18912054b1da1558c1205e6c581cac3e Mon Sep 17 00:00:00 2001 From: piaolingxue Date: Mon, 2 Sep 2013 20:45:12 +0800 Subject: [PATCH 2/3] fix pom file for release. --- pom.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 365307e..0382d1a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,11 @@ 4.0.0 - + + org.sonatype.oss + oss-parent + 7 + com.huaban jieba-analysis 0.0.1-SNAPSHOT @@ -18,11 +22,24 @@ + + scm:git:git@github.com:huaban/jieba-analysis.git + scm:git:git@github.com:huaban/jieba-analysis.git + git@github.com:huaban/jieba-analysis.git + UTF-8 + + + libin + libin + piaolingxue305@gmail.com + + + junit @@ -45,4 +62,5 @@ + From ea73db19e3d95cb53872963ff2324064bd987735 Mon Sep 17 00:00:00 2001 From: piaolingxue Date: Mon, 2 Sep 2013 20:48:14 +0800 Subject: [PATCH 3/3] bumped version number to 1.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0382d1a..4eb692a 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.huaban jieba-analysis - 0.0.1-SNAPSHOT + 0.0.1 jar 结巴分词工具(jieba for java)