diff --git a/doc/CHANGE_LOG.md b/doc/CHANGE_LOG.md
index e2272ff..aaf42f3 100644
--- a/doc/CHANGE_LOG.md
+++ b/doc/CHANGE_LOG.md
@@ -79,4 +79,11 @@
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|:---|:---|:---|:---|:--|
-| 1 | F | 修复依赖包 heaven 版本 | 2020-1-11 09:34:35 | |
\ No newline at end of file
+| 1 | F | 修复依赖包 heaven 版本 | 2020-1-11 09:34:35 | |
+
+# release_0.0.11
+
+| 序号 | 变更类型 | 说明 | 时间 | 备注 |
+|:---|:---|:---|:---|:--|
+| 1 | A | 添加对于数字过滤的可配置型 | 2020-1-14 22:48:12 | |
+| 2 | A | 添加部分敏感词 | 2020-1-14 22:48:12 | |
\ No newline at end of file
diff --git a/doc/issues/roadmap/v011-邮箱检测实现.md b/doc/issues/roadmap/v011-邮箱检测实现.md
index c97ed2a..f4849ce 100644
--- a/doc/issues/roadmap/v011-邮箱检测实现.md
+++ b/doc/issues/roadmap/v011-邮箱检测实现.md
@@ -7,6 +7,21 @@
URL 初期可以不做。
+Image-URL 检测,避免替换错误。
+
+如果 image-url 中包含数字,直接替换就会导致问题。
+
+针对不同的信息脱敏,则需要知道对应的检测代码是什么。
+
+
+## 是否脱敏的配置
+
+- 敏感词 √
+
+- url ×
+
+- 数字 √
+
# 是否为 URL check
可以直接开辟另一道验证方式。
diff --git a/pom.xml b/pom.xml
index bb85b47..014b39e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
1.7
- 0.1.69
+ 0.1.71
1.2.0
diff --git a/release.bat b/release.bat
index cc29d69..164e8c4 100644
--- a/release.bat
+++ b/release.bat
@@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..."
:: 版本号信息(需要手动指定)
:::: 旧版本名称
-SET version=0.0.10
+SET version=0.0.11
:::: 新版本名称
-SET newVersion=0.0.11
+SET newVersion=0.0.12
:::: 组织名称
SET groupName=com.github.houbb
:::: 项目名称
diff --git a/src/main/java/com/github/houbb/sensitive/word/api/ISensitiveCheck.java b/src/main/java/com/github/houbb/sensitive/word/api/ISensitiveCheck.java
index 5fddcf2..08a3eee 100644
--- a/src/main/java/com/github/houbb/sensitive/word/api/ISensitiveCheck.java
+++ b/src/main/java/com/github/houbb/sensitive/word/api/ISensitiveCheck.java
@@ -5,7 +5,7 @@ import com.github.houbb.sensitive.word.constant.enums.ValidModeEnum;
/**
* 敏感信息监测接口
* (1)敏感词
- * (2)数字(连续6位及其以上)
+ * (2)数字(连续8位及其以上)
* (3)邮箱
* (4)URL
*
diff --git a/src/main/java/com/github/houbb/sensitive/word/bs/SensitiveWordBs.java b/src/main/java/com/github/houbb/sensitive/word/bs/SensitiveWordBs.java
index f2c5cf1..d27cd43 100644
--- a/src/main/java/com/github/houbb/sensitive/word/bs/SensitiveWordBs.java
+++ b/src/main/java/com/github/houbb/sensitive/word/bs/SensitiveWordBs.java
@@ -34,6 +34,12 @@ public class SensitiveWordBs {
*/
private volatile IWordContext context;
+ /**
+ * 是否启用数字校验
+ * @since 0.0.11
+ */
+ private boolean enableNumCheck = true;
+
/**
* DCL 初始化 wordMap 信息
* @return 初始化后的结果
@@ -69,9 +75,20 @@ public class SensitiveWordBs {
SensitiveWordBs bs = new SensitiveWordBs();
bs.context = buildDefaultContext();
+
return bs;
}
+ /**
+ * 设置是否启动数字检测
+ * @param enableNumCheck 数字检测
+ * @since 0.0.11
+ */
+ public SensitiveWordBs enableNumCheck(boolean enableNumCheck) {
+ this.context.sensitiveNumCheck(enableNumCheck);
+ return this;
+}
+
/**
* 构建默认的上下文
* @return 结果
diff --git a/src/main/java/com/github/houbb/sensitive/word/support/check/SensitiveNumCheck.java b/src/main/java/com/github/houbb/sensitive/word/support/check/SensitiveNumCheck.java
index 1d26efe..166cefb 100644
--- a/src/main/java/com/github/houbb/sensitive/word/support/check/SensitiveNumCheck.java
+++ b/src/main/java/com/github/houbb/sensitive/word/support/check/SensitiveNumCheck.java
@@ -2,12 +2,17 @@ package com.github.houbb.sensitive.word.support.check;
import com.github.houbb.heaven.annotation.ThreadSafe;
import com.github.houbb.heaven.support.instance.impl.Instances;
+import com.github.houbb.heaven.util.io.FileUtil;
+import com.github.houbb.heaven.util.lang.NumUtil;
+import com.github.houbb.heaven.util.lang.StringUtil;
import com.github.houbb.sensitive.word.api.ISensitiveCheck;
import com.github.houbb.sensitive.word.api.IWordContext;
import com.github.houbb.sensitive.word.constant.enums.ValidModeEnum;
import com.github.houbb.sensitive.word.support.format.CharFormatChain;
import com.github.houbb.sensitive.word.support.format.IgnoreNumStyleCharFormat;
+import java.util.List;
+
/**
* 敏感词监测实现
*
@@ -55,12 +60,13 @@ public class SensitiveNumCheck implements ISensitiveCheck {
/**
* 这里指定一个阈值条件
+ * TODO: 这里有一个问题,会把一些 url 中的数字替换掉。
* @param lengthCount 长度
* @return 是否满足条件
* @since 0.0.5
*/
private boolean isCondition(final int lengthCount) {
- return lengthCount >= 6;
+ return lengthCount >= 8;
}
}
diff --git a/src/main/resources/dict.txt b/src/main/resources/dict.txt
index 09d6466..57dec3e 100644
--- a/src/main/resources/dict.txt
+++ b/src/main/resources/dict.txt
@@ -20384,6 +20384,7 @@ z以留吧以其以武
出气报仇qq
出气报仇服务qq
出气报仇电话
+出版社
出现暴动
出租半张床
出租汽车罢工
@@ -22836,6 +22837,7 @@ z以留吧以其以武
反共
反共传单
反共言论
+反击战
反分裂
反动
反华
@@ -31534,6 +31536,7 @@ z以留吧以其以武
恋足
恋足癖
恐共
+恐怖
恐怖主义
恐怖事件
恐怖人员
@@ -31779,6 +31782,7 @@ z以留吧以其以武
惊天桃色劫
惊尘溅血
惊恐天使档案簿
+惊悚
惊悚空间
惊爆激情夜
惊现5女尸
@@ -32729,6 +32733,7 @@ z以留吧以其以武
戒色是空
或者你直接加我徽信
战乱的星系
+战争
战争正在向我们走来
战争行为
战刀
@@ -32736,6 +32741,7 @@ z以留吧以其以武
战国杂家吕不韦
战国英雄
战场
+战役
战役学纲
战斗条令
战术
@@ -39926,6 +39932,7 @@ z以留吧以其以武
机舱之头等服务
机舱之头等服务txt
机霸大
+杀
杀b
杀人
杀人事件
@@ -44196,6 +44203,7 @@ z以留吧以其以武
润星
涩女日记
涩女日记txt
+涩情
涩爱
涩狼
涪陵楼凤
@@ -46437,6 +46445,7 @@ z以留吧以其以武
犯人数据销售
犯人胡文海
犯法太平常
+犯罪
犯罪替人说情
犯罪记录
犯罪集团
@@ -48455,6 +48464,7 @@ z以留吧以其以武
盗号
盗摄女子公共澡堂
盗撮
+盗版
盗版光碟
盗电
盗窃犯
@@ -54316,6 +54326,7 @@ z以留吧以其以武
艳飘
艳香迷醉
艳魂咒
+艹
艹你
艹句永曰曰
艺坛照妖镜之96应召名册
@@ -54626,7 +54637,6 @@ z以留吧以其以武
茶鱼
茶鱼论坛
荆棘护卫兵
-艹
草
草bbbbbbb
草你
@@ -55308,6 +55318,7 @@ z以留吧以其以武
蟾蜍搬家
蟾蜍迁徙
蠢猪
+血
血b
血书
血债血偿
@@ -58530,6 +58541,7 @@ z以留吧以其以武
连弩销售
连惠心
连战
+连接
连方瑀
连环百家乐
连続失禁
@@ -60048,6 +60060,7 @@ z以留吧以其以武
银都路2688弄20号301室
银龙岛
铸瓷牙齿美容
+链接
销售
销售03式步枪
销售132氯丙酮
@@ -61994,6 +62007,8 @@ z以留吧以其以武
间苯3酚送货上门
间苯3酚配方
间苯3酚销售
+间谍
+间谍战
闵维方
闵耀中
闹事
@@ -65272,4 +65287,26 @@ z以留吧以其以武
𨰾
𫔰苞价咯
彩票
-机票
\ No newline at end of file
+机票
+逃犯
+牛郎
+经济
+大萧条
+死亡
+死
+亡
+港
+台
+凶杀案
+党
+领袖
+军事
+国内
+贫穷
+魔鬼
+毛骨悚然
+和平
+国家
+历史
+警察
+警
\ No newline at end of file
diff --git a/src/test/java/com/github/houbb/sensitive/word/data/DictNumTest.java b/src/test/java/com/github/houbb/sensitive/word/data/DictNumTest.java
index 405d27b..a4dbb7a 100644
--- a/src/test/java/com/github/houbb/sensitive/word/data/DictNumTest.java
+++ b/src/test/java/com/github/houbb/sensitive/word/data/DictNumTest.java
@@ -32,19 +32,19 @@ public class DictNumTest {
@Test
@Ignore
public void formatTest() {
- final String sourceFile = "D:\\github\\sensitive-word\\src\\main\\resources\\dict.txt";
- final String targetFile = "D:\\github\\sensitive-word\\src\\main\\resources\\dict.txt";
+ final String sourceFile = "D:\\_github\\sensitive-word\\src\\main\\resources\\dict.txt";
+ final String targetFile = "D:\\_github\\sensitive-word\\src\\main\\resources\\dict.txt";
List words = FileUtil.readAllLines(sourceFile);
- List formats = CollectionUtil.toList(words, new IHandler() {
- @Override
- public String handle(String string) {
- // 数字的格式化统一处理
- return NumUtils.getMappingString(string);
- }
- });
+// List formats = CollectionUtil.toList(words, new IHandler() {
+// @Override
+// public String handle(String string) {
+// // 数字的格式化统一处理
+// return NumUtils.getMappingString(string);
+// }
+// });
- List resultList = DataUtil.disctinctAndSort(formats);
+ List resultList = DataUtil.disctinctAndSort(words);
FileUtil.write(targetFile, resultList);
}