文本替换添加对应的日志
This commit is contained in:
parent
c085f5f778
commit
d20fe5fd27
|
@ -18,7 +18,7 @@ public class SimulationVoiceHandler {
|
|||
|
||||
static Map<String, String> regexReplaceMap = new HashMap<>();
|
||||
|
||||
// static {
|
||||
// static {
|
||||
// regexReplaceMap.put("一", "1");
|
||||
// }
|
||||
static List<Replacement> numReplacementList;
|
||||
|
@ -147,6 +147,7 @@ public class SimulationVoiceHandler {
|
|||
* 匹配替换对象
|
||||
*/
|
||||
public static class Replacement {
|
||||
|
||||
String match;
|
||||
String replace;
|
||||
|
||||
|
@ -163,12 +164,13 @@ public class SimulationVoiceHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public String numHandle(String content){
|
||||
public String numHandle(String content) {
|
||||
for (Replacement replacement : numReplacementList) {
|
||||
content = replacement.matchAndReplace(content);
|
||||
}
|
||||
return regexReplace(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对语音识别内容进行仿真用词处理
|
||||
*
|
||||
|
@ -183,7 +185,7 @@ public class SimulationVoiceHandler {
|
|||
}
|
||||
|
||||
private String regexReplace(String s) {
|
||||
log.info("正则替换");
|
||||
log.info("正则替换 字符[{}]", s);
|
||||
//编号替换
|
||||
Pattern pattern = Pattern.compile("([一二三四五六七八九十]+)(号)");
|
||||
Matcher matcher = pattern.matcher(s);
|
||||
|
|
Loading…
Reference in New Issue