赞
踩
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;
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。