1.0.8 • Published 6 years ago

word-abuse v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

word-abuse

abuse word filter and replace algorithm using trie and FDA

Install

$npm install word-abuse

Usage

const Abuse = require('word-abuse');
const abuse = new Abuse({
    path:"./consts/abuse/",
    //relative address(compare to process.cwd()) to abuse words files folder
    ignore_path:"./consts/meaningless/"
    //relative address(compare to process.cwd()) to meaningless symbol files folder
});
//or use const abuse = new Abuse() to use default word dictionary included in the module

let words_to_filter = "王@蜜&桃和王$*尼&&玛一起参加暴走大事件";
//abuse words are "王蜜桃", "王尼玛" and "大事件"

let words_after_filter = abuse.findWordInStr(words_to_filter, 0);
//"*@*&*和*$**&&*一起参加暴走***"
  • abuse words dictionary are stored in *.txt files like this:
王蜜桃
王尼玛
暴走漫画
大事件
  • meaningless symbol are stored in *.txt files like this:
@
#
$
%
^
&
*
¥
……
!
!
,
,
.
。
|
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago