From 7be3593656cab52263504fe8b3e47df01bc02fe5 Mon Sep 17 00:00:00 2001 From: houbb Date: Sat, 9 Dec 2023 12:11:00 +0800 Subject: [PATCH] [Feature] add for new --- README.md | 30 +++++++++++-------- .../word/bs/SensitiveWordBsConfigTest.java | 4 +++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a0fd0a3..0a883d3 100644 --- a/README.md +++ b/README.md @@ -369,6 +369,8 @@ SensitiveWordBs wordBs = SensitiveWordBs.newInstance() .enableUrlCheck(true) .enableWordCheck(true) .numCheckLen(8) + .wordTag(WordTags.none()) + .charIgnore(SensitiveWordCharIgnores.defaults()) .init(); final String text = "五星红旗迎风飘扬,毛主席的画像屹立在天安门前。"; @@ -378,19 +380,21 @@ 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 | 是否启用数字检测。 | true | -| 8 | enableEmailCheck | 是有启用邮箱检测 | true | -| 9 | enableUrlCheck | 是否启用链接检测 | true | -| 10 | enableWordCheck | 是否启用敏感单词检测 | true | -| 11 | numCheckLen | 数字检测,自定义指定长度。 | 8 | +| 序号 | 方法 | 说明 | 默认值 | +|:---|:---------------------|:--------------|:------| +| 1 | ignoreCase | 忽略大小写 | true | +| 2 | ignoreWidth | 忽略半角圆角 | true | +| 3 | ignoreNumStyle | 忽略数字的写法 | true | +| 4 | ignoreChineseStyle | 忽略中文的书写格式 | true | +| 5 | ignoreEnglishStyle | 忽略英文的书写格式 | true | +| 6 | ignoreRepeat | 忽略重复词 | false | +| 7 | enableNumCheck | 是否启用数字检测。 | true | +| 8 | enableEmailCheck | 是有启用邮箱检测 | true | +| 9 | enableUrlCheck | 是否启用链接检测 | true | +| 10 | enableWordCheck | 是否启用敏感单词检测 | true | +| 11 | numCheckLen | 数字检测,自定义指定长度。 | 8 | +| 12 | wordTag | 词对应的标签 | none | +| 13 | charIgnore | 忽略的字符 | none | # 忽略字符 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 11cebc5..0252501 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 @@ -2,6 +2,8 @@ package com.github.houbb.sensitive.word.bs; import com.github.houbb.sensitive.word.support.allow.WordAllows; 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.tag.WordTags; import org.junit.Assert; import org.junit.Test; @@ -27,6 +29,8 @@ public class SensitiveWordBsConfigTest { .enableEmailCheck(true) .enableUrlCheck(true) .numCheckLen(8) + .wordTag(WordTags.none()) + .charIgnore(SensitiveWordCharIgnores.defaults()) .init(); final String text = "五星红旗迎风飘扬,毛主席的画像屹立在天安门前。";