|
@@ -0,0 +1,33 @@
|
|
|
+package org.diagbot.nlp.controller;
|
|
|
+
|
|
|
+import org.diagbot.nlp.similar.SimilarCacheUtil;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:
|
|
|
+ * @Author: HUJING
|
|
|
+ * @Date: 2019/10/25 10:38
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/similar")
|
|
|
+public class SimilarController {
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getsimilar", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public static List<String> getSimilarList(@RequestBody String inputWord) {
|
|
|
+ Map<String, List<String>> similarDictMap = SimilarCacheUtil.getSimilar_dict_map();
|
|
|
+ if (similarDictMap.get(inputWord) != null && similarDictMap.get(inputWord).size() > 0) {
|
|
|
+ return similarDictMap.get(inputWord);
|
|
|
+ }
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+}
|