use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testACSegment.
public void testACSegment() throws Exception {
Segment segment = new DoubleArrayTrieSegment();
segment.enablePartOfSpeechTagging(true);
System.out.println(segment.seg("江西鄱阳湖干枯,中国最大淡水湖变成大草原"));
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testViterbi.
public void testViterbi() throws Exception {
HanLP.Config.enableDebug(true);
CustomDictionary.add("网剧");
Segment seg = new DijkstraSegment();
List<Term> termList = seg.seg("优酷总裁魏明介绍了优酷2015年的内容战略,表示要以“大电影、大网剧、大综艺”为关键词");
System.out.println(termList);
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testCRFSegment.
public void testCRFSegment() throws Exception {
HanLP.Config.enableDebug();
// HanLP.Config.ShowTermNature = false;
Segment segment = new CRFSegment();
System.out.println(segment.seg("有句谚语叫做一个萝卜一个坑儿"));
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testIssue199.
public void testIssue199() throws Exception {
Segment segment = new CRFSegment();
// 开启自定义词典
segment.enableCustomDictionary(false);
segment.enablePartOfSpeechTagging(true);
List<Term> termList = segment.seg("更多采购");
System.out.println(termList);
for (Term term : termList) {
if (term.nature == null) {
System.out.println("识别到新词:" + term.word);
}
}
}
use of com.hankcs.hanlp.seg.Segment in project HanLP by hankcs.
the class TestSegment method testTryToCrashSegment.
public void testTryToCrashSegment() throws Exception {
String text = "尝试玩坏分词器";
Segment segment = new ViterbiSegment().enableMultithreading(100);
System.out.println(segment.seg(text));
}
Aggregations