use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestPersonRecognition method testChineseNameRecognition.
public void testChineseNameRecognition() throws Exception {
HanLP.Config.enableDebug();
Segment segment = new DijkstraSegment();
System.out.println(segment.seg("编剧邵钧林和稽道青说"));
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testCustomDictionary.
public void testCustomDictionary() throws Exception {
CustomDictionary.insert("肯德基", "ns 1000");
Segment segment = new ViterbiSegment();
System.out.println(segment.seg("肯德基"));
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testShortest.
public void testShortest() throws Exception {
HanLP.Config.enableDebug();
Segment segment = new ViterbiSegment().enableAllNamedEntityRecognize(true);
System.out.println(segment.seg("把市场经济奉行的等价交换原则引入党的生活和国家机关政务活动中"));
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testIssue193.
public void testIssue193() throws Exception {
String[] testCase = new String[] { "以每台约200元的价格送到苹果售后维修中心换新机(苹果的保修基本是免费换新机)", "可能以2500~2800元的价格回收", "3700个益农信息社打通服务“最后一公里”", "一位李先生给高政留言说上周五可以帮忙献血", "一位浩宁达高层透露", "五和万科长阳天地5个普宅项目", "以1974点低点和5178点高点作江恩角度线", "纳入统计的18家京系基金公司", "华夏基金与嘉实基金两家京系基金公司", "则应从排名第八的投标人开始依次递补三名投标人" };
Segment segment = HanLP.newSegment().enableOrganizationRecognize(true).enableNumberQuantifierRecognize(true);
for (String sentence : testCase) {
List<Term> termList = segment.seg(sentence);
System.out.println(termList);
}
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testIssue343.
public void testIssue343() throws Exception {
CustomDictionary.insert("酷我");
CustomDictionary.insert("酷我音乐");
Segment segment = HanLP.newSegment().enableIndexMode(true);
System.out.println(segment.seg("1酷我音乐2酷我音乐3酷我4酷我音乐6酷7酷我音乐"));
}
Aggregations