Beispiel #1
0
 @RequestMapping(value = "", method = RequestMethod.GET)
 @ResponseBody
 public List<WordDto> get(HttpServletRequest request) throws UnsupportedEncodingException {
   RequestHelper requestHelper = new RequestHelper(request);
   Map<String, String> params = requestHelper.getParams();
   String sentence = params.get("sentence");
   return segmentService.segment(sentence, params);
 }
Beispiel #2
0
 private String segmentForIdeaBoardy(String sentence, Map<String, String> params)
     throws IOException {
   String result;
   List<Map> array = PojoMapper.fromJson(sentence, List.class);
   for (Map obj : array) {
     String content = (String) obj.get("content");
     List<WordDto> words = segmentService.segment(content, params);
     obj.put("segmentResult", words);
   }
   result = PojoMapper.toJson(array);
   return result;
 }
Beispiel #3
0
 private String segmentSentence(String sentence, Map<String, String> params) throws IOException {
   String result;
   List<WordDto> words = segmentService.segment(sentence, params);
   result = PojoMapper.toJson(words);
   return result;
 }