Merge remote-tracking branch 'origin/master'

This commit is contained in:
binbin.hou
2020-01-15 19:24:57 +08:00
9 changed files with 100 additions and 18 deletions

View File

@@ -79,4 +79,11 @@
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|:---|:---|:---|:---|:--|
| 1 | F | 修复依赖包 heaven 版本 | 2020-1-11 09:34:35 | |
| 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 | |

View File

@@ -7,6 +7,21 @@
URL 初期可以不做。
Image-URL 检测,避免替换错误。
如果 image-url 中包含数字,直接替换就会导致问题。
针对不同的信息脱敏,则需要知道对应的检测代码是什么。
## 是否脱敏的配置
- 敏感词 √
- url ×
- 数字 √
# 是否为 URL check
可以直接开辟另一道验证方式。

View File

@@ -25,7 +25,7 @@
<project.compiler.level>1.7</project.compiler.level>
<!--============================== INTER ==============================-->
<heaven.version>0.1.69</heaven.version>
<heaven.version>0.1.71</heaven.version>
<opencc4j.version>1.2.0</opencc4j.version>
<!--============================== OTHER ==============================-->

View File

@@ -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
:::: 项目名称

View File

@@ -5,7 +5,7 @@ import com.github.houbb.sensitive.word.constant.enums.ValidModeEnum;
/**
* 敏感信息监测接口
* 1敏感词
* 2数字连续6位及其以上)
* 2数字连续8位及其以上)
* 3邮箱
* 4URL
*

View File

@@ -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 结果

View File

@@ -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;
}
}

View File

@@ -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以留吧以其以武
𨰾
𫔰苞价咯
彩票
机票
机票
逃犯
牛郎
经济
大萧条
死亡
凶杀案
领袖
军事
国内
贫穷
魔鬼
毛骨悚然
和平
国家
历史
警察

View File

@@ -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<String> words = FileUtil.readAllLines(sourceFile);
List<String> formats = CollectionUtil.toList(words, new IHandler<String, String>() {
@Override
public String handle(String string) {
// 数字的格式化统一处理
return NumUtils.getMappingString(string);
}
});
// List<String> formats = CollectionUtil.toList(words, new IHandler<String, String>() {
// @Override
// public String handle(String string) {
// // 数字的格式化统一处理
// return NumUtils.getMappingString(string);
// }
// });
List<String> resultList = DataUtil.disctinctAndSort(formats);
List<String> resultList = DataUtil.disctinctAndSort(words);
FileUtil.write(targetFile, resultList);
}