unswearify

1.0.3 • Public • Published

unswearify

Image Image

NPM

Installation

npm install unswearify

Usage

const unswearify = require('unswearify');

unswearify.loadProfanities('tr_TR'); // Loading profanity data
unswearify.loadProfanitiesFromFile('/path/to/profanity/array.json'); // Loading profanity data
unswearify.addProfanity("badword") // Add badword to the list

//////////////////

unswearify.isProfanity('badword', 0.9); // Check if word is listed as badword and set custom threshold (optional default is 0.7)
// true

unswearify.getScore('badword'); // Returns calculated similarity of the word
// between 0 to 1

unswearify.findProfanities('This is a badword!'); // Returns array of profanities in a sentence
// [ { word: 'f*ck', score: 0.7416666666666667 } ]

Package Sidebar

Install

npm i unswearify

Weekly Downloads

7

Version

1.0.3

License

ISC

Unpacked Size

36.9 kB

Total Files

10

Last publish

Collaborators

  • raufckk