cl-swearword-detector
v1.0.2
Published
CityLeeks swearword detector
Downloads
5
Maintainers
Readme
CityLeeks-Swearword-Detector
Russian swearword detection and filtering library for CityLeeks.
Installation
npm install --save cl-swearword-detector
Usage
detector.profane(text)
Returns true if the given string contains profanity.
var detector = require('cl-swearword-detector');
detector.profane("я люблю тебя, Гавана"); // false
detector.profane("я люблю тебя, сука"); // true
detector.censor(text)
Replaces profanity with *.
var clean = detector.censor("я люблю тебя, сука"); // я люблю тебя, ****
detector.loadBadWords(path)
Loads a dictionary of words to be used as filter.
detector.loadBadWords("../dicts/swearwords.json");
A dictionary is just a array.
[
"word1",
"word2",
"word3"
]