当前位置:   article > 正文

java word分词器使用_word分词器使用(java)

java word分词 教程

1.在pom.xml中导入依赖

org.apdplat

word

1.1

2.在代码中使用

package com.vortex.commonAPI.controller;

import javax.servlet.http.HttpServletRequest;

import org.apdplat.word.WordSegmenter;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.RestController;

@RestController

@RequestMapping(value = "wordSegmenter")

public class WordSegmenterController {

@RequestMapping(value = "/spliceString", method = RequestMethod.GET)

public Object spliceString(HttpServletRequest request) {

String words = request.getParameter("words");

// 移除停用词进行分词

// List list = WordSegmenter.seg(words);

// 保留停用词

return WordSegmenter.segWithStopWords(words);

}

}

3.实例

322a054f06c8

image

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/610042
推荐阅读
相关标签
  

闽ICP备14008679号