|
|
|
@ -136,8 +136,12 @@ public class RobotTalkServiceImpl implements RobotTalkService {
|
|
|
|
|
* @param input
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String digitToChineseAmount(String input){
|
|
|
|
|
String regex = "(\\d+(\\.\\d+)?)(?=元|万元)";
|
|
|
|
|
private String numberToChinese(String input){
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(input)){
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
String regex = "(\\d+(\\.\\d+)?)(?=元|万元|亿元|个)";
|
|
|
|
|
Pattern pattern = Pattern.compile(regex);
|
|
|
|
|
Matcher matcher = pattern.matcher(input);
|
|
|
|
|
|
|
|
|
@ -223,7 +227,7 @@ public class RobotTalkServiceImpl implements RobotTalkService {
|
|
|
|
|
if (StrUtil.isEmpty(message)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
String translate = digitToChineseAmount(message);
|
|
|
|
|
String translate = numberToChinese(message);
|
|
|
|
|
TtsResultDTO resultDTO = voiceService.textToVoice(translate);
|
|
|
|
|
IrVoice irVoice = new IrVoice();
|
|
|
|
|
irVoice.setVoiceBase64(resultDTO.getAudio());
|
|
|
|
|