mirror of
https://github.com/houbb/sensitive-word.git
synced 2026-03-22 00:17:35 +08:00
release branch 0.27.1
This commit is contained in:
@@ -444,3 +444,9 @@
|
||||
|:---|:-----|------------------------|:-------------------|:---------------------------------------------------|
|
||||
| 1 | D | 移除火车 | 2025-7-19 15:58:55 | https://github.com/houbb/sensitive-word/issues/124 |
|
||||
| 1 | A | 将词库外置为另外一下独立的项目,可以单独排除 | 2025-7-19 15:58:55 | |
|
||||
|
||||
# release_0.27.1
|
||||
|
||||
| 序号 | 变更类型 | 说明 | 时间 | 备注 |
|
||||
|:---|:-----|-----------|:-------------------|:---------------------------------------------------|
|
||||
| 1 | F | 修正词库缺失的问题 | 2025-7-24 23:09:10 | https://github.com/houbb/sensitive-word/issues/125 |
|
||||
|
||||
@@ -110,7 +110,7 @@ v0.24.0 开始内置支持对敏感词的分类细化,不过工作量比较大
|
||||
<dependency>
|
||||
<groupId>com.github.houbb</groupId>
|
||||
<artifactId>sensitive-word</artifactId>
|
||||
<version>0.27.0</version>
|
||||
<version>0.27.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.github.houbb</groupId>
|
||||
<artifactId>sensitive-word</artifactId>
|
||||
<version>0.27.0</version>
|
||||
<version>0.27.1</version>
|
||||
|
||||
<properties>
|
||||
<!--============================== All Plugins START ==============================-->
|
||||
|
||||
@@ -10,7 +10,7 @@ ECHO "============================= RELEASE START..."
|
||||
|
||||
:: 版本号信息(需要手动指定)
|
||||
:::: 旧版本名称
|
||||
SET version=0.27.0
|
||||
SET version=0.27.1
|
||||
:::: 新版本名称
|
||||
SET newVersion=0.28.0
|
||||
:::: 组织名称
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.github.houbb.sensitive.word.support.allow;
|
||||
|
||||
import com.github.houbb.heaven.annotation.ThreadSafe;
|
||||
import com.github.houbb.heaven.util.io.StreamUtil;
|
||||
import com.github.houbb.sensitive.word.api.IWordAllow;
|
||||
import com.github.houbb.sensitive.word.api.IWordDeny;
|
||||
import com.github.houbb.sensitive.word.utils.InnerStreamUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,7 +25,7 @@ public class WordAllowSystem implements IWordAllow {
|
||||
|
||||
@Override
|
||||
public List<String> allow() {
|
||||
return StreamUtil.readAllLines("/sensitive_word_allow.txt");
|
||||
return InnerStreamUtils.readAllLines("/sensitive_word_allow.txt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.github.houbb.sensitive.word.support.deny;
|
||||
|
||||
import com.github.houbb.heaven.annotation.ThreadSafe;
|
||||
import com.github.houbb.heaven.util.io.StreamUtil;
|
||||
import com.github.houbb.sensitive.word.api.IWordDeny;
|
||||
import com.github.houbb.sensitive.word.utils.InnerStreamUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,9 +25,9 @@ public class WordDenySystem implements IWordDeny {
|
||||
|
||||
@Override
|
||||
public List<String> deny() {
|
||||
List<String> results = StreamUtil.readAllLines("/sensitive_word_dict.txt");
|
||||
results.addAll(StreamUtil.readAllLines("/sensitive_word_dict_en.txt"));
|
||||
results.addAll(StreamUtil.readAllLines("/sensitive_word_deny.txt"));
|
||||
List<String> results = InnerStreamUtils.readAllLines("/sensitive_word_dict.txt");
|
||||
results.addAll(InnerStreamUtils.readAllLines("/sensitive_word_dict_en.txt"));
|
||||
results.addAll(InnerStreamUtils.readAllLines("/sensitive_word_deny.txt"));
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.github.houbb.sensitive.word.support.tag;
|
||||
|
||||
import com.github.houbb.heaven.util.io.StreamUtil;
|
||||
import com.github.houbb.sensitive.word.api.IWordTag;
|
||||
import com.github.houbb.sensitive.word.utils.InnerStreamUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -16,7 +16,7 @@ public class WordTagSystem extends AbstractWordTag {
|
||||
private final IWordTag wordTag;
|
||||
|
||||
public WordTagSystem() {
|
||||
List<String> lines = StreamUtil.readAllLines("/sensitive_word_tags.txt");
|
||||
List<String> lines = InnerStreamUtils.readAllLines("/sensitive_word_tags.txt");
|
||||
this.wordTag = WordTags.lines(lines);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.github.houbb.sensitive.word.utils;
|
||||
|
||||
import com.github.houbb.heaven.util.io.StreamUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @since 0.27.1
|
||||
*/
|
||||
public class InnerStreamUtils {
|
||||
|
||||
/**
|
||||
* 获取文件,兼容为空的场景
|
||||
* @param path 路径
|
||||
* @return 结果
|
||||
*/
|
||||
public static List<String> readAllLines(String path) {
|
||||
try(InputStream inputStream = StreamUtil.class.getResourceAsStream(path);) {
|
||||
if(inputStream == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return StreamUtil.readAllLines(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user