mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
add mynlp
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.hutool.extra.tokenizer;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -12,6 +13,7 @@ import cn.hutool.extra.tokenizer.engine.ikanalyzer.IKAnalyzerEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.jcseg.JcsegEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.jieba.JiebaEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.mmseg.MmsegEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.mynlp.MynlpEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.word.WordEngine;
|
||||
|
||||
/**
|
||||
@@ -86,6 +88,16 @@ public class TokenizerUtilTest {
|
||||
Assert.assertEquals("这两个 方法 的 区别 在于 返回值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void mynlpTest() {
|
||||
// 此单元测试需要JDK8,默认忽略
|
||||
TokenizerEngine engine = new MynlpEngine();
|
||||
Result result = engine.parse(text);
|
||||
String resultStr = CollUtil.join((Iterator<Word>)result, " ");
|
||||
Assert.assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
}
|
||||
|
||||
private void checkResult(Result result) {
|
||||
String resultStr = CollUtil.join((Iterator<Word>)result, " ");
|
||||
Assert.assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
|
Reference in New Issue
Block a user