美文网首页
Mynlp的分词插件功能实现

Mynlp的分词插件功能实现

作者: 菠萝炒鸡蛋 | 来源:发表于2020-08-26 19:22 被阅读0次

代码:

/**
 * 字典插件
 */
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("逛吃行动小组成立"));
    }
}

相关文章

网友评论

      本文标题:Mynlp的分词插件功能实现

      本文链接:https://www.haomeiwen.com/subject/zcmfsktx.html