tspace-bad-words
v1.0.0
Published
tspace-bad-words is a flexible and easy-to-use bad word filter with predictive variants support for **Thai** and **English**. Detects and censors vulgar words with customizable censoring options.
Maintainers
Readme
tspace-bad-words
tspace-bad-words is a flexible and easy-to-use bad word filter with predictive variants support for Thai and English. Detects and censors vulgar words with customizable censoring options.
Features
- Supports basic and extended Thai & English bad words
- Generates predictive variants with symbols/spaces
- Easily add or exclude words dynamically
Installation
npm install tspace-bad-words
Basic Usage
import BadWordFilter from 'tspace-bad-words';
const filter = new BadWordFilter();
// Filter text with default censoring ('***')
const input = 'ไอ้ควาย shit พ่อเมิง';
const censored = filter.filter(input);
console.log(censored); // *** *** *** ***
// Customize censor string
filter.setCensor('###');
console.log(filter.filter(input)); // ### ### ### ###
// Add new bad words dynamically
filter.add(['จัญไร', 'bastards']);
// Exclude some words from censoring
filter.except(['shit']); // 'shit' will NOT be censored now
