feat(module-llm):增加热线电话格式脱敏- 新增热线电话正则表达式 HOTLINE_REGEX
- 在文本脱敏处理中增加热线电话格式的匹配和替换
This commit is contained in:
parent
a5071fd2c0
commit
645244a2cb
@ -533,6 +533,7 @@ public class DataProcessUtil {
|
||||
*/
|
||||
private static final String DOMESTIC_PHONE_REGEX = "(\\d{4}-|\\d{3}-)?(\\d{8}|\\d{7})";
|
||||
|
||||
private static final String HOTLINE_REGEX = "^\\d{3,4}(-\\d{3,4})+$";
|
||||
/**
|
||||
* 电话号码(400)的正则表达式
|
||||
*/
|
||||
@ -551,7 +552,8 @@ public class DataProcessUtil {
|
||||
// 编译正则表达式为Pattern对象
|
||||
private static final Pattern MOBILE_PATTERN = Pattern.compile(MOBILE_REGEX);
|
||||
private static final Pattern DOMESTIC_PHONE_PATTERN = Pattern.compile(DOMESTIC_PHONE_REGEX);
|
||||
private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX);
|
||||
private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX);
|
||||
private static final Pattern HOTLINE_PATTERN = Pattern.compile(HOTLINE_REGEX);
|
||||
private static final Pattern CREDIT_CARD_PATTERN = Pattern.compile(CREDIT_CARD_REGEX);
|
||||
private static final Pattern HASH_PATTERN = Pattern.compile(HASH_REGEX);
|
||||
|
||||
@ -619,6 +621,10 @@ public class DataProcessUtil {
|
||||
Matcher phoneMatcher = PHONE_PATTERN.matcher(text);
|
||||
text = phoneMatcher.replaceAll("");
|
||||
|
||||
// 热线电话格式的正则表达式
|
||||
Matcher hotlinePhoneMatcher = HOTLINE_PATTERN.matcher(text);
|
||||
text = hotlinePhoneMatcher.replaceAll("");
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user