Java实现分词(结巴分词)/(Jieba分词)

  • Post author:
  • Post category:java



1、引入依赖

<!--        结巴分词-->
        <dependency>
            <groupId>com.huaban</groupId>
            <artifactId>jieba-analysis</artifactId>
            <version>1.0.2</version>
        </dependency>


2、写方法类

/**
 * 依赖于JIEBA的Maven依赖
 * 输入一个String类型的句子,调用结巴进行分词,返回一个List
 */
public class JIEBA {

        public static List JIEBA(String text){
        JiebaSegmenter segmenter = new JiebaSegmenter();
        List<SegToken> res = segmenter.process(text, JiebaSegmenter.SegMode.INDEX);
        return res;
    }
    
}



版权声明:本文为qq_33980633原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。