解析词条优化
This commit is contained in:
parent
9d5b471b73
commit
644dd8e43a
@ -33,14 +33,14 @@ public class NlpService {
|
|||||||
Actions actions = new Actions();
|
Actions actions = new Actions();
|
||||||
actions.setActions(new ArrayList<>());
|
actions.setActions(new ArrayList<>());
|
||||||
//nlp.getKeys().sort(Comparator.comparing(NlpKey::getType)); //解析,按照type从小到大排序
|
//nlp.getKeys().sort(Comparator.comparing(NlpKey::getType)); //解析,按照type从小到大排序
|
||||||
Action action = null;
|
Action action = new Action();
|
||||||
String name = "";
|
String name = "";
|
||||||
/*new Action();
|
|
||||||
|
|
||||||
action.setName(new ArrayList<>());
|
action.setName(new ArrayList<>());
|
||||||
action.setLbs(new ArrayList<>());
|
action.setLbs(new ArrayList<>());
|
||||||
action.setAsk(text);*/
|
action.setAsk(text);
|
||||||
int a = 1, b = 1;
|
int a = 0, b = 0;
|
||||||
List<SystemTalkAnswerConfigEntity> systemTalkAnswerConfigEntities = new ArrayList<>();
|
List<SystemTalkAnswerConfigEntity> systemTalkAnswerConfigEntities = new ArrayList<>();
|
||||||
SystemTalkAnswerConfigEntity lastSystemTalkAnswerConfigEntity = null;
|
SystemTalkAnswerConfigEntity lastSystemTalkAnswerConfigEntity = null;
|
||||||
String lastName = null;
|
String lastName = null;
|
||||||
@ -66,12 +66,13 @@ public class NlpService {
|
|||||||
action.getName().add(lastName);
|
action.getName().add(lastName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
actions.getActions().add(action);
|
||||||
action = new Action();
|
action = new Action();
|
||||||
name = "";
|
name = "";
|
||||||
action.setName(new ArrayList<>());
|
action.setName(new ArrayList<>());
|
||||||
action.setLbs(new ArrayList<>());
|
action.setLbs(new ArrayList<>());
|
||||||
action.setAsk(text);
|
action.setAsk(text);
|
||||||
actions.getActions().add(action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key.getType().equals(ChinesePartSpeechEnum.v.getCode())){
|
if(key.getType().equals(ChinesePartSpeechEnum.v.getCode())){
|
||||||
@ -117,6 +118,7 @@ public class NlpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotEmpty(name)){
|
if(StringUtils.isNotEmpty(name)){
|
||||||
|
|
||||||
SystemTalkAnswerConfigEntity entity = systemTalkAnswerConfigService.getSystemTalkWithKey(name);
|
SystemTalkAnswerConfigEntity entity = systemTalkAnswerConfigService.getSystemTalkWithKey(name);
|
||||||
@ -138,6 +140,9 @@ public class NlpService {
|
|||||||
}else if(lastSystemTalkAnswerConfigEntity != null){
|
}else if(lastSystemTalkAnswerConfigEntity != null){
|
||||||
action.setSystemTalkAnswerConfigEntity(lastSystemTalkAnswerConfigEntity);
|
action.setSystemTalkAnswerConfigEntity(lastSystemTalkAnswerConfigEntity);
|
||||||
action.setAction(action.getSystemTalkAnswerConfigEntity().getAskKey());
|
action.setAction(action.getSystemTalkAnswerConfigEntity().getAskKey());
|
||||||
|
actions.getActions().add(action);
|
||||||
|
}else if(a + b == 2){
|
||||||
|
actions.getActions().add(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return actions;
|
return actions;
|
||||||
|
|||||||
@ -251,7 +251,7 @@ public class BaseWebSocketProcess {
|
|||||||
//做相应的动作
|
//做相应的动作
|
||||||
baseSession.getMusic().setPlay(action.getSystemTalkAnswerConfigEntity().getPlayType());
|
baseSession.getMusic().setPlay(action.getSystemTalkAnswerConfigEntity().getPlayType());
|
||||||
resp.setMusic(baseSession.getMusic());
|
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());
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
sendMessage(action, baseSession, resp);
|
sendMessage(action, baseSession, resp);
|
||||||
}else{
|
}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
Loading…
x
Reference in New Issue
Block a user