1.修改默认的相似匹配度

2. 匹配相似度之前对句子进行清洗
main
xueqingkun 11 months ago
parent c0120ba23b
commit a32af5363f

@ -81,6 +81,9 @@ public class MatchToolServiceImpl implements MatchToolService {
public List<MatchQuestionAnswerDTO> execMatch(String question) { public List<MatchQuestionAnswerDTO> execMatch(String question) {
log.info("开始调用talkQaSimilarity,问题:{}", question); log.info("开始调用talkQaSimilarity,问题:{}", question);
try { try {
// 清洗数据,去除句子中的字母和数字,以提高相似度
question = StrUtil.replace(question, "[a-zA-Z0-9\\s+]", m->"");
log.info("经过去除字母和数字清洗后的字符串是:{}",question);
TimeInterval timer = DateUtil.timer(); TimeInterval timer = DateUtil.timer();
String post = HttpUtil.post(matchToolUrl + "/matchQuestion", JSONUtil.toJsonStr(new QuestionReqDTO(question, Double.valueOf(scoreThreshold)))); String post = HttpUtil.post(matchToolUrl + "/matchQuestion", JSONUtil.toJsonStr(new QuestionReqDTO(question, Double.valueOf(scoreThreshold))));
log.info("相似度匹配答案:{},耗时:{} 毫秒", post,timer.intervalMs()); log.info("相似度匹配答案:{},耗时:{} 毫秒", post,timer.intervalMs());
@ -100,7 +103,6 @@ public class MatchToolServiceImpl implements MatchToolService {
return null; return null;
} }
} }
@Override @Override
public ExtractInformationDTO extractInformation(String message) { public ExtractInformationDTO extractInformation(String message) {
log.info("开始调用extractInformation,message:{}", message); log.info("开始调用extractInformation,message:{}", message);

@ -54,7 +54,7 @@ spring:
merge-sql: false merge-sql: false
matchTool: matchTool:
url: http://${env.match.ip} url: http://${env.match.ip}
scoreThreshold: 0.4 scoreThreshold: 0.3
paddle-speech: paddle-speech:
# https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-RESTful-API # https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-RESTful-API
tts: http://${env.paddle-speech.ip}/paddlespeech/tts tts: http://${env.paddle-speech.ip}/paddlespeech/tts

Loading…
Cancel
Save