Wondering what’s next for npm?Check out our public roadmap! »

cl-swearword-detector

1.0.2 • Public • Published

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

Install

npm i cl-swearword-detector

DownloadsWeekly Downloads

1

Version

1.0.2

License

The MIT License (MIT)

Last publish

Collaborators

  • avatar