All Projects → raymondjavaxx → swearjar-node

raymondjavaxx / swearjar-node

Licence: MIT license
Profanity detection and filtering library.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to swearjar-node

google-profanity-words
Full list of bad words and top swear words banned by Google.
Stars: ✭ 357 (+417.39%)
Mutual labels:  profanity, profanity-detection
retext-profanities
plugin to check for profane and vulgar wording
Stars: ✭ 34 (-50.72%)
Mutual labels:  profanity
IsSeptaFcked
Real-time status for Philadelphia Regional Rail
Stars: ✭ 47 (-31.88%)
Mutual labels:  profanity
restrict-cursing-action
Github Action to prevent cursing and bad language in issues and pull requests
Stars: ✭ 20 (-71.01%)
Mutual labels:  profanity-detection

swearjar-node

Profanity detection and filtering library.

Build Status

Installation

npm install --save swearjar

Usage

swearjar.profane(text)

Returns true if the given string contains profanity.

var swearjar = require('swearjar');
swearjar.profane("hello there"); // false
swearjar.profane("hello mother f-bomb"); // true

swearjar.censor(text)

Replaces profanity with asterisks.

var clean = swearjar.censor("f-bomb you"); // **** you

swearjar.scorecard(text)

Generates a report from the given text.

swearjar.scorecard("f-bomb you"); // {sexual: 1, inappropriate: 1}

swearjar.loadBadWords(path)

Loads a dictionary of words to be used as filter.

NOTE: A US English default list located in the config directory is included and loaded by default.

swearjar.loadBadWords('./config/profanity.json');

A dictionary is just a plain JSON file containing an object where its keys are the words to check for and the values are arrays of categories where the words fall in.

{
	"word1": ["category1", "category2"],
	"word2": ["category1"],
	"word3": ["category2"]
}

Acknowledgements

swearjar-node is based on Swearjar (Ruby) and Swearjar PHP.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].