You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

bad-words-checker

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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 lan

1.2.1
latest
npmnpm
Version published
Weekly downloads
4
-50%
Maintainers
0
Weekly downloads
 
Created
Source

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);



FAQs

Package last updated on 28 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts