From 65176b8345447cb560cc098e8e5c5463763c1c30 Mon Sep 17 00:00:00 2001 From: zhangxiaomeng <1362468712@qq.com> Date: Thu, 6 Feb 2025 16:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E4=B8=8A=E4=BC=A0=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kcui/src/assets/img/typeHeadChoose.png | Bin 0 -> 3120 bytes kcui/src/view/TWInfoXq.vue | 215 +++++++++++++++++++++ .../woka/Web/Controller/FileUpdateController.java | 77 ++++++++ src/main/java/com/main/woka/Web/Dao/KcTwImg.java | 41 ++++ .../java/com/main/woka/Web/Mapper/TwImgMapper.java | 13 ++ src/main/resources/CoreNLP-chinese.properties | 44 +++++ src/main/resources/Mapper/TwImgMapper.xml | 34 ++++ 7 files changed, 424 insertions(+) create mode 100644 kcui/src/assets/img/typeHeadChoose.png create mode 100644 kcui/src/view/TWInfoXq.vue create mode 100644 src/main/java/com/main/woka/Web/Controller/FileUpdateController.java create mode 100644 src/main/java/com/main/woka/Web/Dao/KcTwImg.java create mode 100644 src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java create mode 100644 src/main/resources/CoreNLP-chinese.properties create mode 100644 src/main/resources/Mapper/TwImgMapper.xml diff --git a/kcui/src/assets/img/typeHeadChoose.png b/kcui/src/assets/img/typeHeadChoose.png new file mode 100644 index 0000000000000000000000000000000000000000..1b87ee999863b1a7fc7e48819beda5ccd7bfd3a3 GIT binary patch literal 3120 zcmV-04A1k4P)0)6I000a3Nkl& z-;W$e5y!vPGk0-f2ivg^|B4|_f`elMLP97%B%~-05T5xfdEpP>4GEbSBt#$}grY=X z@`MmhP(YsPLOs*fQ(fIXdwbsV+2@w#W_EUWrf>SQ->R;v8G4&N9;q<{0|TQ6Mt&Y6 zzlXuU56_n|#{Hh>W#nZ$ER1rS4&+1Jlnq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GcP1ZR_^5ItX#JNya(VH zHfnBx3W2MiOw&VP@s|=r#>5eFf5}CK8l~7>7jRX8DytgmPWZNi^GJhvf*>6wa&8^- zBIVL>(rdFmZSs0iEN9H%bnI>t9pH_3z#rdBN!lE!*8u!1hSy!{Y-Z*JB%Sn?fTn^- zo4BA-Y>T>3Q7AjJt6bfq4%SHkcAQ`}fvTj(S~EUpRflqaD#2u9S1FZ3jc@NWQr zPu+Q&{i`uw_oMisve|pDh3Nk z*^}**YV`)L`cv)x1mKs!rwU3H6zW_oP527HAJl*9k|a$L)97@kJ5G7=m8O6u&-Zq9 z?BJ(`tByEVP2Q48+E5W_n#+E#hx;BC<@JYyR=&4w!sMuZJlykh7NMNW;%5ATxQY)thCNxl4}_LFL_j1;N%kkfBirGbK!O%10$IL0000< KMNUMnLSTYU>HMPr literal 0 HcmV?d00001 diff --git a/kcui/src/view/TWInfoXq.vue b/kcui/src/view/TWInfoXq.vue new file mode 100644 index 0000000..6d6b4d0 --- /dev/null +++ b/kcui/src/view/TWInfoXq.vue @@ -0,0 +1,215 @@ + + + diff --git a/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java b/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java new file mode 100644 index 0000000..65f08cb --- /dev/null +++ b/src/main/java/com/main/woka/Web/Controller/FileUpdateController.java @@ -0,0 +1,77 @@ +package com.main.woka.Web.Controller; + + +import com.main.woka.Common.core.AjaxResult; +import com.main.woka.Common.util.file.FileUploadUtils; +import com.main.woka.Common.util.file.FileUtils; +import com.main.woka.Config.RuoYiConfig; +import com.main.woka.Config.ServerConfig; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Date; + +@RestController +@RequestMapping("/fileUpdate") +public class FileUpdateController extends BaseController { + + + // 定义上传文件的存储路径 + private static final String UPLOAD_DIR = "D:/kcfz/upload/"; + + @PostMapping("/upload") + public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) { + if (file.isEmpty()) { + return AjaxResult.error(); + } + + try { + // 确保上传目录存在 + File uploadDir = new File(UPLOAD_DIR); + if (!uploadDir.exists()) { + uploadDir.mkdirs(); + } + + // 获取文件名并生成唯一的文件名 + String fileName = generateUniqueFileName(file.getOriginalFilename()); + Path filePath = Paths.get(UPLOAD_DIR, fileName); + + // 将文件写入磁盘 + Files.copy(file.getInputStream(), filePath); + + // 返回文件访问路径 + String fileAccessPath = "http://127.0.0.1:10031/profile/" + fileName; + AjaxResult ajaxResult = new AjaxResult(); + ajaxResult.put("fileName",fileName); + ajaxResult.put("url",fileAccessPath); + return AjaxResult.success(ajaxResult); + } catch (IOException e) { + e.printStackTrace(); + return AjaxResult.error(); + } + } + + // 生成唯一的文件名 + private String generateUniqueFileName(String originalFileName) { + String extension = ""; + int i = originalFileName.lastIndexOf('.'); + if (i > 0) { + extension = originalFileName.substring(i); + } + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String timestamp = sdf.format(new Date()); + + return timestamp + "_" + Math.abs(originalFileName.hashCode()) + extension; + } +} diff --git a/src/main/java/com/main/woka/Web/Dao/KcTwImg.java b/src/main/java/com/main/woka/Web/Dao/KcTwImg.java new file mode 100644 index 0000000..021ae7a --- /dev/null +++ b/src/main/java/com/main/woka/Web/Dao/KcTwImg.java @@ -0,0 +1,41 @@ +package com.main.woka.Web.Dao; + +public class KcTwImg { + private Long imgId; + private Long twId; + private String imgUrl; + + + public Long getImgId() { + return imgId; + } + + public void setImgId(Long imgId) { + this.imgId = imgId; + } + + public Long getTwId() { + return twId; + } + + public void setTwId(Long twId) { + this.twId = twId; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + @Override + public String toString() { + return "KcTwImg{" + + "imgId=" + imgId + + ", twId=" + twId + + ", imgUrl='" + imgUrl + '\'' + + '}'; + } +} diff --git a/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java b/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java new file mode 100644 index 0000000..100cd86 --- /dev/null +++ b/src/main/java/com/main/woka/Web/Mapper/TwImgMapper.java @@ -0,0 +1,13 @@ +package com.main.woka.Web.Mapper; + +import com.main.woka.Web.Dao.KcTwImg; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TwImgMapper { + public int insertTwImg(List list); + + List getKcTwImgList(Long id); +} diff --git a/src/main/resources/CoreNLP-chinese.properties b/src/main/resources/CoreNLP-chinese.properties new file mode 100644 index 0000000..073c26a --- /dev/null +++ b/src/main/resources/CoreNLP-chinese.properties @@ -0,0 +1,44 @@ +# Pipeline options - lemma is no-op for Chinese but currently needed because coref demands it (bad old requirements system) + +#设定了管道中包括哪些Annotators(一个Annotator就是你需要的文本分析分析工具, 他的结果就是一个或多个Annotation) +#segment:分词, ssplit:分隔, pos: 词性标注, lemma: has->have, ner:命名实体识别, parse:语法分析 +annotators = segment, ssplit, pos, lemma, ner, parse, sentiment, mention, coref +#annotators = segment, ssplit, pos, parse, sentiment + + +# segment 分词 +customAnnotatorClass.segment = edu.stanford.nlp.pipeline.ChineseSegmenterAnnotator +segment.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese/pku.gz +segment.sighanCorporaDict = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese +segment.serDictionary = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/segmenter/chinese/dict-chris6.ser.gz +segment.sighanPostProcessing = true + +# sentence split +ssplit.boundaryTokenRegex = [.]|[!?]+|[\u3002]|[\uFF01\uFF1F]+ + +# pos +pos.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/pos-tagger/chinese-distsim/chinese-distsim.tagger + +#ner 此处设定了ner使用的语言、模型(crf),目前SUTime只支持英文,不支持中文,所以设置为false。 +ner.language = chinese +ner.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/ner/chinese.misc.distsim.crf.ser.gz +ner.applyNumericClassifiers = true +ner.useSUTime = false + +#parse +parse.model = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/lexparser/chineseFactored.ser.gz + +# coref +coref.sieves = ChineseHeadMatch, ExactStringMatch, PreciseConstructs, StrictHeadMatch1, StrictHeadMatch2, StrictHeadMatch3, StrictHeadMatch4, PronounMatch +coref.input.type = raw +coref.postprocessing = true +coref.calculateFeatureImportance = false +coref.useConstituencyTree = true +coref.useSemantics = false +coref.md.type = RULE +coref.mode = hybrid +coref.path.word2vec = +coref.language = zh +coref.print.md.log = false +coref.defaultPronounAgreement = true +coref.zh.dict = D:/tupudata/nlp/stanford-corenlp-3.9.1-models-chinese/edu/stanford/nlp/models/dcoref/zh-attributes.txt.gz diff --git a/src/main/resources/Mapper/TwImgMapper.xml b/src/main/resources/Mapper/TwImgMapper.xml new file mode 100644 index 0000000..0995fa8 --- /dev/null +++ b/src/main/resources/Mapper/TwImgMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + INSERT INTO tw_img + (tw_id,img_url) + VALUES + + (#{item.twId},#{item.imgUrl}) + + + + + + + + + + +