diff --git a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordAllow.java b/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordAllow.java deleted file mode 100644 index c690ef0..0000000 --- a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordAllow.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.luoo.comment.sensitiveWord; - -import com.github.houbb.sensitive.word.api.IWordAllow; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; - -@Component -public class MyDdWordAllow implements IWordAllow { - - @Override - public List allow() { - List list = new ArrayList<>(); - list.add("五星红旗"); - list.add("天安门"); - - return list; - } - -} diff --git a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordDeny.java b/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordDeny.java deleted file mode 100644 index c470896..0000000 --- a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/MyDdWordDeny.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.luoo.comment.sensitiveWord; - -import com.github.houbb.sensitive.word.api.IWordDeny; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -@Component -public class MyDdWordDeny implements IWordDeny { - - @Override - public List deny() { - List list = new ArrayList<>(); - list.add("落网"); - Resource mySensitiveWords = new ClassPathResource("denyWords.txt"); - try { - Path mySensitiveWordsPath = Paths.get(mySensitiveWords.getFile().getPath()); - list = Files.readAllLines(mySensitiveWordsPath, StandardCharsets.UTF_8); - - } catch (IOException e) { - throw new RuntimeException(e); - } - - return list; - } -} \ No newline at end of file diff --git a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/SensitiveWordService.java b/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/SensitiveWordService.java deleted file mode 100644 index 40bf027..0000000 --- a/luoo_comment/src/main/java/com/luoo/comment/sensitiveWord/SensitiveWordService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.luoo.comment.sensitiveWord; - -import com.github.houbb.sensitive.word.bs.SensitiveWordBs; -import org.springframework.beans.factory.annotation.Autowired; - -public class SensitiveWordService { - - @Autowired - private SensitiveWordBs sensitiveWordBs; - - /** - * 更新词库 - *

- * 每次数据库的信息发生变化之后,首先调用更新数据库敏感词库的方法。 - * 如果需要生效,则调用这个方法。 - *

- * 说明:重新初始化不影响旧的方法使用。初始化完成后,会以新的为准。 - */ - public void refresh() { - // 每次数据库的信息发生变化之后,首先调用更新数据库敏感词库的方法,然后调用这个方法。 - sensitiveWordBs.init(); - } -} \ No newline at end of file