Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including word-abuse with all npm packages installed. Try it out:

var wordAbuse = require("word-abuse")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

word-abuse v1.0.8

abuse word filter and replace algorithm using trie and DFA


abuse word filter and replace algorithm using trie and FDA


$npm install word-abuse


const Abuse = require('word-abuse');
const abuse = new Abuse({
    //relative address(compare to process.cwd()) to abuse words files folder
    //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:

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free