From a6536db8599670e9e4756c204ece82ba99992f54 Mon Sep 17 00:00:00 2001 From: houbb Date: Mon, 17 Feb 2025 12:56:25 +0800 Subject: [PATCH] [Feature] add for new --- README.md | 43 ++++++++++--------- .../word/bs/SensitiveWordBsConfigTest.java | 2 + 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 3f159e7..27cbc28 100644 --- a/README.md +++ b/README.md @@ -501,28 +501,29 @@ Assert.assertTrue(wordBs.contains(text)); 其中各项配置的说明如下: -| 序号 | 方法 | 说明 | 默认值 | -|:---|:---------------------|:-----------------------------|:------| -| 1 | ignoreCase | 忽略大小写 | true | -| 2 | ignoreWidth | 忽略半角圆角 | true | -| 3 | ignoreNumStyle | 忽略数字的写法 | true | -| 4 | ignoreChineseStyle | 忽略中文的书写格式 | true | -| 5 | ignoreEnglishStyle | 忽略英文的书写格式 | true | -| 6 | ignoreRepeat | 忽略重复词 | false | -| 7 | enableNumCheck | 是否启用数字检测。 | false | -| 8 | enableEmailCheck | 是有启用邮箱检测 | false | -| 9 | enableUrlCheck | 是否启用链接检测 | false | -| 10 | enableIpv4Check | 是否启用IPv4检测 | false | -| 11 | enableWordCheck | 是否启用敏感单词检测 | true | -| 12 | numCheckLen | 数字检测,自定义指定长度。 | 8 | -| 13 | wordTag | 词对应的标签 | none | +| 序号 | 方法 | 说明 | 默认值 | +|:---|:--------------------|:-----------------------------|:------| +| 1 | ignoreCase | 忽略大小写 | true | +| 2 | ignoreWidth | 忽略半角圆角 | true | +| 3 | ignoreNumStyle | 忽略数字的写法 | true | +| 4 | ignoreChineseStyle | 忽略中文的书写格式 | true | +| 5 | ignoreEnglishStyle | 忽略英文的书写格式 | true | +| 6 | ignoreRepeat | 忽略重复词 | false | +| 7 | enableNumCheck | 是否启用数字检测。 | false | +| 8 | enableEmailCheck | 是有启用邮箱检测 | false | +| 9 | enableUrlCheck | 是否启用链接检测 | false | +| 10 | enableIpv4Check | 是否启用IPv4检测 | false | +| 11 | enableWordCheck | 是否启用敏感单词检测 | true | +| 12 | numCheckLen | 数字检测,自定义指定长度。 | 8 | +| 13 | wordTag | 词对应的标签 | none | | 14 | charIgnore | 忽略的字符 | none | -| 15 | wordResultCondition | 针对匹配的敏感词额外加工,比如可以限制英文单词必须全匹配 | 恒为真 | -| 16 | wordCheckNum | 数字检测策略(v0.25.0开始支持) | `WordChecks.num()` | -| 17 | wordCheckEmail | 邮箱检测策略(v0.25.0开始支持) | `WordChecks.email()` | -| 18 | wordCheckUrl | URL检测策略(v0.25.0开始支持) | `(WordChecks.url()` | -| 19 | wordCheckIpv4 | ipv4检测策略(v0.25.0开始支持) | `WordChecks.ipv4()` | -| 20 | wordCheckWord | 敏感词检测策略(v0.25.0开始支持) | `WordChecks.word()` | +| 15 | wordResultCondition | 针对匹配的敏感词额外加工,比如可以限制英文单词必须全匹配 | 恒为真 | +| 16 | wordCheckNum | 数字检测策略(v0.25.0开始支持) | `WordChecks.num()` | +| 17 | wordCheckEmail | 邮箱检测策略(v0.25.0开始支持) | `WordChecks.email()` | +| 18 | wordCheckUrl | URL检测策略(v0.25.0开始支持) | `(WordChecks.url()` | +| 19 | wordCheckIpv4 | ipv4检测策略(v0.25.0开始支持) | `WordChecks.ipv4()` | +| 20 | wordCheckWord | 敏感词检测策略(v0.25.0开始支持) | `WordChecks.word()` | +| 21 | wordReplace | 替换策略 | `WordReplaces.defaults()` | ## 内存资源的释放 diff --git a/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsConfigTest.java b/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsConfigTest.java index 0e16b23..6612bcb 100644 --- a/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsConfigTest.java +++ b/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsConfigTest.java @@ -7,6 +7,7 @@ import com.github.houbb.sensitive.word.support.allow.WordAllows; import com.github.houbb.sensitive.word.support.check.WordChecks; import com.github.houbb.sensitive.word.support.deny.WordDenys; import com.github.houbb.sensitive.word.support.ignore.SensitiveWordCharIgnores; +import com.github.houbb.sensitive.word.support.replace.WordReplaces; import com.github.houbb.sensitive.word.support.resultcondition.WordResultConditions; import com.github.houbb.sensitive.word.support.tag.WordTags; import org.junit.Assert; @@ -51,6 +52,7 @@ public class SensitiveWordBsConfigTest { .wordResultCondition(WordResultConditions.alwaysTrue()) .wordAllow(WordAllows.defaults()) .wordDeny(WordDenys.defaults()) + .wordReplace(WordReplaces.defaults()) .init(); }