From 737146b3c460dab0ea9e14376c3599d7bfb83adf Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Wed, 31 May 2023 16:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8D=E6=80=A7=E6=A0=87=E6=B3=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=9F=B1=E7=8A=B6=E5=9B=BE=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DocInfoController.java | 29 +++++++++++++++++++ .../business/service/CategoryService.java | 3 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/controller/DocInfoController.java b/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/controller/DocInfoController.java index cb2da75..f9be45c 100644 --- a/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/controller/DocInfoController.java +++ b/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/controller/DocInfoController.java @@ -103,6 +103,13 @@ public class DocInfoController extends BaseController { result.put("labelCategories",MyObjects.labelCategories); Sentence sentence = DependencyParserUtils.nerAnalysis(content); List wordList = sentence.wordList; + int noun=0; + int personalName=0; + int placeName=0; + int InstitutionalGroup=0; + int verb=0; + int adjective=0; + int adverb=0; if(wordList!=null&&wordList.size()>0){ int offset = 0; int id = 0; @@ -115,6 +122,21 @@ public class DocInfoController extends BaseController { Integer categoryId = MyObjects.wordsMapping.get(label); JSONObject jsonObject = new JSONObject(); jsonObject.put("id",id); + if(categoryId==0){ + noun++; + }else if(categoryId==1){ + personalName++; + }else if(categoryId==2){ + placeName++; + }else if(categoryId==3){ + InstitutionalGroup++; + }else if(categoryId==4){ + verb++; + }else if(categoryId==5){ + adjective++; + }else if(categoryId==6){ + adverb++; + } jsonObject.put("categoryId",categoryId); jsonObject.put("startIndex",startIndex); jsonObject.put("endIndex",endIndex); @@ -125,6 +147,13 @@ public class DocInfoController extends BaseController { } result.put("labels",labels); } + result.put("noun",noun); + result.put("personalName",personalName); + result.put("placeName",placeName); + result.put("institutionalGroup",InstitutionalGroup); + result.put("verb",verb); + result.put("adjective",adjective); + result.put("adverb",adverb); return AjaxResult.success("查询成功",result); } diff --git a/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/service/CategoryService.java b/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/service/CategoryService.java index b84890c..01c82ea 100644 --- a/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/service/CategoryService.java +++ b/ruoyi-biemo/src/main/java/com/ruoyi/biemo/business/service/CategoryService.java @@ -63,7 +63,8 @@ public class CategoryService extends EsService { if(id==null||id.trim().length()==0){ return null; } - List categories = esLambdaQuery().eq(Category::getId,id).query(); +// List categories = esLambdaQuery().eq(Category::getId,id).query(); + List categories = esLambdaQuery().getDoc_InfoBy_Id(Category::getId,id).query(); return categories!=null&&categories.size()>0?categories.get(0):null; }