use of com.hankcs.hanlp.seg.NShort.NShortSegment in project HanLP by hankcs.
the class TestXianDaiHanYu method testSeg.
public void testSeg() throws Exception {
Segment segment = new NShortSegment().enableNameRecognize(true);
HanLP.Config.enableDebug(true);
System.out.println(segment.seg("我在区人保工作"));
}
use of com.hankcs.hanlp.seg.NShort.NShortSegment in project HanLP by hankcs.
the class TestPersonRecognition method testNameRecognition.
public void testNameRecognition() throws Exception {
HanLP.Config.enableDebug();
NShortSegment segment = new NShortSegment();
System.out.println(segment.seg("世界上最长的姓名是简森·乔伊·亚历山大·比基·卡利斯勒·达夫·埃利奥特·福克斯·伊维鲁莫·马尔尼·梅尔斯·帕特森·汤普森·华莱士·普雷斯顿。"));
}
use of com.hankcs.hanlp.seg.NShort.NShortSegment in project HanLP by hankcs.
the class DemoNShortSegment method main.
public static void main(String[] args) {
Segment nShortSegment = new NShortSegment().enableCustomDictionary(false).enablePlaceRecognize(true).enableOrganizationRecognize(true);
Segment shortestSegment = new ViterbiSegment().enableCustomDictionary(false).enablePlaceRecognize(true).enableOrganizationRecognize(true);
String[] testCase = new String[] { "今天,刘志军案的关键人物,山西女商人丁书苗在市二中院出庭受审。", "江西省监狱管理局与中国太平洋财产保险股份有限公司南昌中心支公司保险合同纠纷案", "新北商贸有限公司" };
for (String sentence : testCase) {
System.out.println("N-最短分词:" + nShortSegment.seg(sentence) + "\n最短路分词:" + shortestSegment.seg(sentence));
}
}
Aggregations