-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/test/java/com/hankcs/hanlp/dictionary/CustomDictionaryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.hankcs.hanlp.dictionary; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class CustomDictionaryTest extends TestCase | ||
{ | ||
public void testReload() throws Exception | ||
{ | ||
assertEquals(true, CustomDictionary.reload()); | ||
assertEquals(true, CustomDictionary.contains("中华白海豚")); | ||
} | ||
} |
dca825b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用python调API方式,有直接添加自定义字典的方法吗?比如load_userdict("dict.txt")这种吗?
dca825b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HanLP.Config. CustomDictionaryPath = ["dict.txt","dict2.txt"]
CustomDictionary.reload()