用于nodejs的开源违禁词检测工具 JavaScript node-word-detection

地址 : https://www.npmjs.com/package/node-word-detection

github地址: https://github.com/xiaobaidadada/node-word-detection

非常节省内存的轻量级快速违禁词、词典库 检测工具 、 50万个词大约需要300MB内存、被检测的文本100+字内结果在1毫秒左右。本项目没有提供词库请自己在别的项目下载。

Install

npm install node-word-detection

Example

js 复制代码
const {node_word_detection} = require("node-word-detection");
node_word_detection.add_word("单词1");
node_word_detection.add_word("word2");
node_word_detection.add_word("test");
console.log(node_word_detection.check_word("0h781单词123njn"));
// print true
console.log(node_word_detection.check_word("4s3142"));
// print false
console.log(check_word_replace.check_word("4s3单词1dac142test","***"));
// print { have: true, str: '4s3***1dac142***' }

说明

本项目使用了预构建(支持大部分Node版本最好使用node18以上),不需要编译而是从github下载编译好的文件,如果你电脑上的网络安装的时候无法访问github则会退化成编译。请安装项目中devDependencies依赖,在windows上编译可能遇到的问题可以参考这个链接https://blog.csdn.net/jjocwc/article/details/134152602

相关推荐
粥里有勺糖1 天前
视野修炼-技术周刊第127期 | Valdi
前端·javascript·github
码上成长1 天前
Vue Router 3 升级 4:写法、坑点、兼容一次讲透
前端·javascript·vue.js
百锦再1 天前
第15章 并发编程
android·java·开发语言·python·rust·django·go
864记忆1 天前
Qt QML 模块及其函数详解
开发语言·qt
无敌最俊朗@1 天前
C++ 对象布局之padding(填充字节)
开发语言·c++
共享家95271 天前
高级IO-poll
开发语言·操作系统·io
zhousenshan1 天前
node语法特性详解
node.js
Chiang木1 天前
C++进阶:coroutine 协程
开发语言·c++·协程
是Yu欸1 天前
仓颉迁移实战:将 Node.js 微服务移植到 Cangjie 的工程化评测
微服务·云原生·开源·node.js·vim·gitcode·cangjie
ivy159868377151 天前
JM20329是一款高性能、低功耗的USB桥接芯片,实现串行接口(如SATA、IDE)与USB接口之间的数据转换。
c语言·开发语言·ide·嵌入式硬件·eureka·音视频·视频编解码