mirror of
https://github.com/houbb/sensitive-word.git
synced 2026-03-22 08:27:36 +08:00
release branch 0.18.0
This commit is contained in:
@@ -324,3 +324,9 @@
|
|||||||
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|
||||||
|:---|:-----|---------|:------------------|:------|
|
|:---|:-----|---------|:------------------|:------|
|
||||||
| 1 | A | IPV4 校验 | 2024-6-01 15:02:25 | https://github.com/houbb/sensitive-word/issues/43 |
|
| 1 | A | IPV4 校验 | 2024-6-01 15:02:25 | https://github.com/houbb/sensitive-word/issues/43 |
|
||||||
|
|
||||||
|
# release_0.18.0
|
||||||
|
|
||||||
|
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|
||||||
|
|:---|:-----|-------------------------|:-------------------|:-----|
|
||||||
|
| 1 | A | 优化网址匹配策略,避免命中 1.jpg 之类的 | 2024-7-07 15:02:25 | |
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -52,15 +52,14 @@
|
|||||||
|
|
||||||
[CHANGE_LOG.md](https://github.com/houbb/sensitive-word/blob/master/CHANGE_LOG.md)
|
[CHANGE_LOG.md](https://github.com/houbb/sensitive-word/blob/master/CHANGE_LOG.md)
|
||||||
|
|
||||||
### V0.16.2:
|
|
||||||
|
|
||||||
- 移除部分敏感词
|
|
||||||
- 默认关闭 url/email/num 的校验
|
|
||||||
|
|
||||||
### V0.17.0
|
### V0.17.0
|
||||||
|
|
||||||
- 支持 ipv4
|
- 支持 ipv4
|
||||||
|
|
||||||
|
### V0.18.0
|
||||||
|
|
||||||
|
- 优化 URL 检测,降低误判率
|
||||||
|
|
||||||
## 更多资料
|
## 更多资料
|
||||||
|
|
||||||
### 敏感词控台
|
### 敏感词控台
|
||||||
@@ -91,7 +90,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<artifactId>sensitive-word</artifactId>
|
<artifactId>sensitive-word</artifactId>
|
||||||
<version>0.17.0</version>
|
<version>0.18.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -393,15 +392,14 @@ Assert.assertEquals("[]", wordList2.toString());
|
|||||||
|
|
||||||
用于过滤常见的网址信息,默认未启用。
|
用于过滤常见的网址信息,默认未启用。
|
||||||
|
|
||||||
```java
|
v0.18.0 优化 URL 检测,更加严格,降低误判率
|
||||||
final String text = "点击链接 www.baidu.com查看答案";
|
|
||||||
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance().enableUrlCheck(true).init();
|
|
||||||
|
|
||||||
'
|
|
||||||
List<String> wordList = sensitiveWordBs.findAll(text);
|
|
||||||
Assert.assertEquals("[www.baidu.com]", wordList.toString());
|
|
||||||
|
|
||||||
Assert.assertEquals("点击链接 *************查看答案", sensitiveWordBs.replace(text));
|
```java
|
||||||
|
final String text = "点击链接 https://www.baidu.com 查看答案";
|
||||||
|
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance().enableUrlCheck(true).init();
|
||||||
|
List<String> wordList = sensitiveWordBs.findAll(text);
|
||||||
|
Assert.assertEquals("[https://www.baidu.com]", wordList.toString());
|
||||||
|
Assert.assertEquals("点击链接 ********************* 查看答案", sensitiveWordBs.replace(text));
|
||||||
```
|
```
|
||||||
|
|
||||||
### IPV4 检测
|
### IPV4 检测
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.github.houbb</groupId>
|
<groupId>com.github.houbb</groupId>
|
||||||
<artifactId>sensitive-word</artifactId>
|
<artifactId>sensitive-word</artifactId>
|
||||||
<version>0.17.0</version>
|
<version>0.18.0</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!--============================== All Plugins START ==============================-->
|
<!--============================== All Plugins START ==============================-->
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<project.compiler.level>1.7</project.compiler.level>
|
<project.compiler.level>1.7</project.compiler.level>
|
||||||
|
|
||||||
<!--============================== INTER ==============================-->
|
<!--============================== INTER ==============================-->
|
||||||
<heaven.version>0.10.0</heaven.version>
|
<heaven.version>0.11.0</heaven.version>
|
||||||
<opencc4j.version>1.8.1</opencc4j.version>
|
<opencc4j.version>1.8.1</opencc4j.version>
|
||||||
|
|
||||||
<!--============================== OTHER ==============================-->
|
<!--============================== OTHER ==============================-->
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ ECHO "============================= RELEASE START..."
|
|||||||
|
|
||||||
:: 版本号信息(需要手动指定)
|
:: 版本号信息(需要手动指定)
|
||||||
:::: 旧版本名称
|
:::: 旧版本名称
|
||||||
SET version=0.17.0
|
SET version=0.18.0
|
||||||
:::: 新版本名称
|
:::: 新版本名称
|
||||||
SET newVersion=0.18.0
|
SET newVersion=0.19.0
|
||||||
:::: 组织名称
|
:::: 组织名称
|
||||||
SET groupName=com.github.houbb
|
SET groupName=com.github.houbb
|
||||||
:::: 项目名称
|
:::: 项目名称
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class WordCheckUrl extends AbstractConditionWordCheck {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCharCondition(char mappingChar, int index, InnerSensitiveWordContext checkContext) {
|
protected boolean isCharCondition(char mappingChar, int index, InnerSensitiveWordContext checkContext) {
|
||||||
return CharUtil.isWebSiteChar(mappingChar);
|
return CharUtil.isWebSiteChar(mappingChar) || mappingChar == ':' || mappingChar == '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -58,8 +58,9 @@ public class WordCheckUrl extends AbstractConditionWordCheck {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 改为 http:// 或者 https:// 开头
|
||||||
String string = stringBuilder.toString();
|
String string = stringBuilder.toString();
|
||||||
return RegexUtil.isWebSite(string);
|
return RegexUtil.isUrl(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ public class SensitiveWordBsUrlTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void commonUrlTest() {
|
public void commonUrlTest() {
|
||||||
final String text = "点击链接 www.baidu.com查看答案";
|
final String text = "点击链接 https://www.baidu.com 查看答案";
|
||||||
|
|
||||||
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance().enableUrlCheck(true).init();
|
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance().enableUrlCheck(true).init();
|
||||||
List<String> wordList = sensitiveWordBs.findAll(text);
|
List<String> wordList = sensitiveWordBs.findAll(text);
|
||||||
Assert.assertEquals("[www.baidu.com]", wordList.toString());
|
Assert.assertEquals("[https://www.baidu.com]", wordList.toString());
|
||||||
|
|
||||||
Assert.assertEquals("点击链接 *************查看答案", sensitiveWordBs.replace(text));
|
Assert.assertEquals("点击链接 ********************* 查看答案", sensitiveWordBs.replace(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,15 +39,15 @@ public class SensitiveWordBsUrlTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void imageUrlTest() {
|
public void imageUrlTest() {
|
||||||
final String text = "双击查看大图 www.big-image.png查看";
|
final String text = "双击查看大图 http://www.big-image.png 查看";
|
||||||
|
|
||||||
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance()
|
final SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance()
|
||||||
.enableUrlCheck(true)
|
.enableUrlCheck(true)
|
||||||
.init();
|
.init();
|
||||||
List<String> wordList = sensitiveWordBs.findAll(text);
|
List<String> wordList = sensitiveWordBs.findAll(text);
|
||||||
Assert.assertEquals("[www.big-image.png]", wordList.toString());
|
Assert.assertEquals("[http://www.big-image.png]", wordList.toString());
|
||||||
|
|
||||||
Assert.assertEquals("双击查看大图 *****************查看", sensitiveWordBs.replace(text));
|
Assert.assertEquals("双击查看大图 ************************ 查看", sensitiveWordBs.replace(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user