代码:
/**
* 字典插件
*/
public class PipelinePlugin {
public static void main(String[] args) {
//自定义词典
MemCustomDictionary dictionary = new MemCustomDictionary();
dictionary.addWord("逛吃");
dictionary.rebuild();
FluentLexerBuilder builder = Lexers.coreBuilder()
.withPos()
.withPersonName();
//配置插件
builder.with(new CustomDictionaryPlugin((dictionary)));
Lexer lexer = builder.build();
System.out.println(lexer.scan("逛吃行动小组成立"));
}
}
网友评论