Skip to content

Commit

Permalink
修正CustomDictionary.reload(); fix #1100
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Feb 22, 2019
1 parent 532bf04 commit ef28d97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ public static boolean reload()
String path[] = HanLP.Config.CustomDictionaryPath;
if (path == null || path.length == 0) return false;
IOUtil.deleteFile(path[0] + Predefine.BIN_EXT); // 删掉缓存
dat = new DoubleArrayTrie<CoreDictionary.Attribute>();
return loadMainDictionary(path[0]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,10 @@ public void testIssue540() throws Exception
CustomDictionary.remove("123");
CustomDictionary.remove("摩根");
}

public void testReload()
{
CustomDictionary.reload();
System.out.println(HanLP.segment("自然语言处理"));
}
}

0 comments on commit ef28d97

Please sign in to comment.