Skip to content

Commit

Permalink
更新demo,加入一个有意思的真实歧义句
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Sep 23, 2015
1 parent d3f7ed6 commit 0f89c9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ public boolean saveTxtTo(String path)
public static void main(String[] args)
{
EasyDictionary dictionary = EasyDictionary.create("data/dictionary/2014_dictionary.txt");
final NTDictionaryMaker nsDictionaryMaker = new NTDictionaryMaker(dictionary);
final NTDictionaryMaker ntDictionaryMaker = new NTDictionaryMaker(dictionary);
// CorpusLoader.walk("D:\\JavaProjects\\CorpusToolBox\\data\\2014\\", new CorpusLoader.Handler()
CorpusLoader.walk("data/test/nt/test/", new CorpusLoader.Handler()
{
@Override
public void handle(Document document)
{
nsDictionaryMaker.compute(document.getComplexSentenceList());
ntDictionaryMaker.compute(document.getComplexSentenceList());
}
});
// nsDictionaryMaker.saveTxtTo("D:\\JavaProjects\\HanLP\\data\\dictionary\\organization\\nt");
// ntDictionaryMaker.saveTxtTo("D:\\JavaProjects\\HanLP\\data\\dictionary\\organization\\nt");
}
}
1 change: 1 addition & 0 deletions src/test/java/com/hankcs/demo/DemoSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static void main(String[] args)
"结婚的和尚未结婚的确实在干扰分词啊",
"买水果然后来世博园最后去世博会",
"中国的首都是北京",
"欢迎新老师生前来就餐",
"工信处女干事每月经过下属科室都要亲口交代24口交换机等技术性器件的安装工作",
"随着页游兴起到现在的页游繁盛,依赖于存档进行逻辑判断的设计减少了,但这块也不能完全忽略掉。",
};
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/com/hankcs/test/seg/TestSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,18 @@ public class TestSegment extends TestCase
public void testSeg() throws Exception
{
HanLP.Config.enableDebug();
CustomDictionary.insert("义消人员");
Segment segment = new DijkstraSegment();
System.out.println(segment.seg(
"基隆市长林右昌对义消人员长期协助消防救灾工作"
"王春桂"
));
}

public void testViterbi() throws Exception
{
// HanLP.Config.enableDebug(true);
CustomDictionary.add("荒野求生");
// CustomDictionary.add("荒野求生");
Segment seg = HanLP.newSegment().enableAllNamedEntityRecognize(true);
List<Term> termList = seg.seg("奥巴马挑战荒野求生");
List<Term> termList = seg.seg("中国海军152舰艇编队到访埃及");
System.out.println(termList);
}

Expand Down

0 comments on commit 0f89c9a

Please sign in to comment.