词性标注修改

master
yz
parent f361a4f0f8
commit 47bdb8ccf8

@ -23,12 +23,12 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://120.78.220.29:3306/makesoft?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Biemo123
# url: jdbc:mysql://39.108.144.227:1637/makesoft?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://120.78.220.29:3306/makesoft?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: Biemo123
url: jdbc:mysql://39.108.144.227:1637/makesoft?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Biemo123
# url: jdbc:mysql://118.31.7.2:3306/makesoft?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: sztzjy2017

@ -83,7 +83,7 @@ public class DocInfoController extends BaseController {
}
@GetMapping("/getEmotionAnalysisByCateId/{categoryId}")
public AjaxResult getEmotionAnalysis(@PathVariable String categoryId){
public AjaxResult getEmotionAnalysis(@PathVariable String categoryId) throws IOException {
EmotionResult emotionResult = docInfoService.getEmotionAnalysis(categoryId);
return AjaxResult.success(emotionResult);
}

@ -16,8 +16,10 @@ import java.util.List;
*
*/
public class SentimentAnalysisUtils {
public static final String CORPUS_FOLDER = TestUtility.ensureTestData("ChnSentiCorp", "http://hanlp.linrunsoft.com/release/corpus/ChnSentiCorp.zip");
public static final String MODEL_PATH = "D:\\code\\TextBigData\\data\\test\\sentiment-classification-model.ser";
public static final String CORPUS_FOLDER = TestUtility.ensureTest2Data("ChnSentiCorp", "http://hanlp.linrunsoft.com/release/corpus/ChnSentiCorp.zip");
// public static final String MODEL_PATH = "D:\\code\\TextBigData\\data\\test\\sentiment-classification-model.ser";
public static final String MODEL_PATH = "/usr/local/textjar/analysis-hanlp/data/test/sentiment-classification-model.ser";
public static String analysis(String text){
String result = "";

@ -0,0 +1,58 @@
package com.ruoyi.biemo.utils;
import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class FormatUtil {
/**
*
* @param oldString
* @return
* @throws IOException
*/
public static String RemovalOfStopWords(String oldString) throws IOException {
String newString = oldString;
// 分词
List<Term> termList = HanLP.segment(newString);
// 中文 停用词 .txt 文件路径
String filePath = "/usr/local/textjar/analysis-hanlp/data/test/stop.txt";
File file = new File(filePath);
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
List<String> stopWords = new ArrayList<>();
String temp = null;
while ((temp = bufferedReader.readLine()) != null) {
//System.out.println("*" + temp+ "*");
stopWords.add(temp.trim());
}
List<String> termStringList = new ArrayList<>();
for(Term term:termList) {
termStringList.add(term.word);
//System.out.println("*" + term.word + "*");
}
termStringList.removeAll(stopWords);
newString = "";
for (String string:termStringList) {
newString += string;
}
return newString;
}
}

@ -30,7 +30,7 @@ public class TestUtility
{
// ensureData("data/model/crf", "http://nlp.hankcs.com/download.php?file=data", ".", false);
// ensureData("D:\\tianze\\文本大数据\\analysis-hanlp\\data\\model\\crf", "http://nlp.hankcs.com/download.php?file=data", ".", false);
ensureData("/usr/local/textjar/analysis-hanlp/data/model/crf", "http://nlp.hankcs.com/download.php?file=data", ".", false);
ensureData("/usr/local/textjar/analysis-hanlp/data//model/crf", "http://nlp.hankcs.com/download.php?file=data", ".", false);
}
/**

Loading…
Cancel
Save