1.3.7 • Published 2 years ago

byebyeswear v1.3.7

Weekly downloads
-
License
The MIT License (...
Repository
-
Last release
2 years ago

CityLeeks-Swearword-Detector

Russian swearword detection and filtering library for CityLeeks.

Build Status Coverage Status

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"
]