diff --git a/CHANGE_LOG.md b/CHANGE_LOG.md index d6b2969..8c516e7 100644 --- a/CHANGE_LOG.md +++ b/CHANGE_LOG.md @@ -349,3 +349,9 @@ | 序号 | 变更类型 | 说明 | 时间 | 备注 | |:---|:-----|-------------------------------|:-------------------|:---| | 1 | F | 修正 englishWordMatch 单个字符误判的问题 | 2024-8-28 15:02:25 | https://github.com/houbb/sensitive-word/issues/69 | + +# release_0.19.2 + +| 序号 | 变更类型 | 说明 | 时间 | 备注 | +|:---|:-----|--------------------------------------------------------|:-------------------|:--------------------------------------------------| +| 1 | F | 修正 #68 SensitiveWordCharIgnores.specialChars() 误判命中开始的问题 | 2024-8-28 15:02:25 | https://github.com/houbb/sensitive-word/issues/68 | diff --git a/README.md b/README.md index de96a5e..69367ce 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,10 @@ - 修正 englishWordMatch #69 单个英文字符命中错误问题 +### V0.19.2 + +- 修正 #68 `SensitiveWordCharIgnores.specialChars()` 误判命中开始的问题 + ## 更多资料 ### 敏感词控台 @@ -93,7 +97,7 @@ com.github.houbb sensitive-word - 0.19.1 + 0.19.2 ``` diff --git a/pom.xml b/pom.xml index fbb1159..23e8de6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.houbb sensitive-word - 0.19.1 + 0.19.2 diff --git a/release.bat b/release.bat index 72e117f..20c118f 100644 --- a/release.bat +++ b/release.bat @@ -10,7 +10,7 @@ ECHO "============================= RELEASE START..." :: 版本号信息(需要手动指定) :::: 旧版本名称 -SET version=0.19.1 +SET version=0.19.2 :::: 新版本名称 SET newVersion=0.20.0 :::: 组织名称 diff --git a/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java b/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java index bf2d0b1..a582b83 100644 --- a/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java +++ b/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java @@ -53,7 +53,8 @@ public class WordCheckWord extends AbstractWordCheck { int tempLen = 0; for(int i = beginIndex; i < rawChars.length; i++) { // 判断是否跳过? - if(wordCharIgnore.ignore(i, rawChars, innerContext)) { + // 避免开始的时候命中 https://github.com/houbb/sensitive-word/issues/68 + if(wordCharIgnore.ignore(i, rawChars, innerContext) && tempLen != 0) { tempLen++; continue; } diff --git a/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsIgnoreCharTest.java b/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsIgnoreCharTest.java index 81b4174..f4ec942 100644 --- a/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsIgnoreCharTest.java +++ b/src/test/java/com/github/houbb/sensitive/word/bs/SensitiveWordBsIgnoreCharTest.java @@ -36,4 +36,18 @@ public class SensitiveWordBsIgnoreCharTest { Assert.assertEquals("[傻@冒, 狗+东西]", wordList2.toString()); } + //https://github.com/houbb/sensitive-word/issues/68 + @Test + public void ignoreChineseStyleTest2() { + final String text = "

傻逼

"; + + // 指定忽略的字符策略,可自行实现。 + List wordList2 = SensitiveWordBs.newInstance() + .charIgnore(SensitiveWordCharIgnores.specialChars()) + .init() + .findAll(text); + + Assert.assertEquals("[傻逼]", wordList2.toString()); + } + }