# sensitive-word-processor-spring-boot-project **Repository Path**: skqing/sensitive-word-processor-spring-boot-project ## Basic Information - **Project Name**: sensitive-word-processor-spring-boot-project - **Description**: 敏感词处理器,支持返回敏感词,高亮敏感词,替换敏感词等操作。核心内容整理自网络,自己封装成了spring-boot-project。 - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2021-08-09 - **Last Updated**: 2024-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sensitive-word-processor-spring-boot-project 敏感词处理器,支持返回敏感词,高亮敏感词,替换敏感词等操作,算法为trie树实现,查找速度快。 # trie树概述 又称单词查找树,trie树,是一种树形结构,是一种哈希树的变种。 典型应用是用于统计,排序和保存大量的字符串(但不仅限于字符串),所以经常被搜索引擎系统用于文本词频统计。 它的优点是:利用字符串的公共前缀来减少查询时间,最大限度地减少无谓的字符串比较,查询效率比哈希树高。 关于trie树详细信息请自行baidu # 代码示例 因为敏感词原因,需要把sensitive-word-processor-spring-boot-simple中的sensitive-word.zip解压再运行示例程序 # 使用方法 使用者可以自己通过以上代码构建来调用,也可以使用已经封装好的SimpleKWSeekerProcessor.java SimpleKWSeekerProcessor采用从配置文件初始化敏感词,并且是单例的,方便任何地方调用。 只需要在classpaht下加入配置文件sensitive-word.properties 配置文件的格式为: 敏感词配置key=value,key和value可以随意更改 key为敏感词的类型,value为敏感词,多个敏感词以'英文逗号'分割 因为.properties文件默认以Unicode编码保存中文。 所以如下配置内容想要以中文方式打开,可以通过浏览器打开在线转码的网站查看中文原文。 例:http://tool.chinaz.com/tools/unicode.aspx ,将如下内容粘贴到转码框,点击 Unicode转中文即可 **第三方云服务** https://dun.163.com/trial/text https://xiaodun.com/product/text?source=baidu&keyword=%E6%95%8F%E6%84%9F%E8%AF%8D%E6%A3%80%E6%B5%8B&e_creative=47190125225&e_keywordid=232670183915&e_keywordid2=232670183915 https://ai.baidu.com/tech/textcensoring?track=cp:ainsem|pf:pc|pp:chanpin-neirongshenhe|pu:neirongshenhe-weijinjiancechaxun|ci:|kw:10001991 **参考整理** [自定义Spring Boot Starter终极开发教程](https://felord.cn/springbootstarter.html) [教你手写一个spring-boot-starter组件](http://autumn200.com/2020/07/03/write-spring-boot-starter/)