解析词条优化

This commit is contained in:
wulin 2023-10-07 13:18:29 +08:00
parent 9d5b471b73
commit 644dd8e43a
5 changed files with 17237 additions and 6 deletions

View File

@ -33,14 +33,14 @@ public class NlpService {
Actions actions = new Actions();
actions.setActions(new ArrayList<>());
//nlp.getKeys().sort(Comparator.comparing(NlpKey::getType)); //解析,按照type从小到大排序
Action action = null;
Action action = new Action();
String name = "";
/*new Action();
action.setName(new ArrayList<>());
action.setLbs(new ArrayList<>());
action.setAsk(text);*/
int a = 1, b = 1;
action.setAsk(text);
int a = 0, b = 0;
List<SystemTalkAnswerConfigEntity> systemTalkAnswerConfigEntities = new ArrayList<>();
SystemTalkAnswerConfigEntity lastSystemTalkAnswerConfigEntity = null;
String lastName = null;
@ -66,12 +66,13 @@ public class NlpService {
action.getName().add(lastName);
}
actions.getActions().add(action);
action = new Action();
name = "";
action.setName(new ArrayList<>());
action.setLbs(new ArrayList<>());
action.setAsk(text);
actions.getActions().add(action);
}
if(key.getType().equals(ChinesePartSpeechEnum.v.getCode())){
@ -117,6 +118,7 @@ public class NlpService {
}
}
if(StringUtils.isNotEmpty(name)){
SystemTalkAnswerConfigEntity entity = systemTalkAnswerConfigService.getSystemTalkWithKey(name);
@ -138,6 +140,9 @@ public class NlpService {
}else if(lastSystemTalkAnswerConfigEntity != null){
action.setSystemTalkAnswerConfigEntity(lastSystemTalkAnswerConfigEntity);
action.setAction(action.getSystemTalkAnswerConfigEntity().getAskKey());
actions.getActions().add(action);
}else if(a + b == 2){
actions.getActions().add(action);
}
return actions;

View File

@ -251,7 +251,7 @@ public class BaseWebSocketProcess {
//做相应的动作
baseSession.getMusic().setPlay(action.getSystemTalkAnswerConfigEntity().getPlayType());
resp.setMusic(baseSession.getMusic());
resp.setText("" + action.getAction() + baseSession.getMusic().getSinger());
resp.setText(action.getSystemTalkAnswerConfigEntity().getAnswerValue().replace("#name#", baseSession.getMusic().getName()));
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
sendMessage(action, baseSession, resp);
}else{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff