bad-words-checker
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

bad-words-checker

bad-words-checker is an npm package designed to detect and censor harmful words in text content. This package is especially useful for protecting children from exposure to violent, sexually explicit, and discriminatory language. It supports multiple languages including English, Arabic, Chinese, French, German, Greek, Hebrew, Hindi, Indonesian, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Thai, and Vietnamese.

Supported Languages

The package supports the following languages: English Arabic Chinese French German Greek Hebrew Hindi Indonesian Italian Japanese Korean Portuguese Russian Spanish Thai Vietnamese

Installation

To install bad-words-checker, run the following command:

npm install bad-words-checker


Usage
Below is an example of how to use bad-words-checker in your project:
    import {
    RegExpMatcher,
    TextCensor,
    englishDataset,
    englishRecommendedTransformers,
    } from 'obscenity';
    import {
    checkChineseText,
    checkFrenchText,
    checkGermanText,
    checkGreekText,
    checkHebrewText,
    checkHindiText,
    checkItalianText,
    checkJapaneseText,
    checkKoreanText,
    checkPortugueseText,
    checkRussianText,
    checkSpanishText,
    checkThaiText,
    checkVietnameseText,
    } from 'bad-words-checker';

    // Initialize the English matcher
    const englishMatcher = new RegExpMatcher({
    ...englishDataset.build(),
    ...englishRecommendedTransformers,
    });

    // Function to check text based on selected language
    const checkText = (language, text) => {
    let result;
    switch (language) {
        case 'hindi':
        result = checkHindiText(text);
        break;
        case 'chinese':
        result = checkChineseText(text);
        break;
        // Add cases for other languages as needed
        // ...
        default:
        result = englishMatcher.replace(text, '*');
    }
    return result;
    };

    // Example usage
    const textToCheck = "your text here";
    const language = "hindi"; // Change to desired language
    const result = checkText(language, textToCheck);
    console.log(result);


Readme

Keywords

none

Package Sidebar

Install

npm i bad-words-checker

Weekly Downloads

0

Version

1.2.1

License

ISC

Unpacked Size

206 kB

Total Files

6

Last publish

Collaborators

  • ankit1478