Tired of offensive language in your app? 🚫 BadFilter.js to the rescue! We’ve crafted a supercharged, customizable solution that helps developers filter out inappropriate words like a pro. Let's make the internet a friendlier place one word at a time! 🌐💬
BadFilter.js offers two powerful components:
- FilterBadWord Class: The core engine of the library, responsible for detecting and filtering unwanted words from text.
- filters_badword Function: A simplified, express-mode interface that wraps around
FilterBadWordfor quick and easy usage.
These tools let you build respectful, safe online environments with minimal effort. 🚀✨
Both FilterBadWord and filters_badword leverage Natural Language Processing (NLP) and Machine Learning (ML) to perform accurate and intelligent filtering.
- Tokenization: Text is broken down into words (tokens) 🧩.
- NLP Analysis: Tokens are scanned for potential offensive content using NLP techniques 🕵️♂️.
- Machine Learning: Each interaction makes the filter smarter at catching new or obfuscated terms ✨.
- Customization: You can configure how strict or lenient the filter should be with advanced options 🎛️.
Include it in your browser-based projects:
<!-- Add BadFilter.js via CDN --> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/badfilter-js@2.0.13/dist/badword.min.js"></script> <!-- or --> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/badfilter-js@2.0.13/js/badword.min.js"></script> <!-- Or use ES Module --> <script type="module" src="https://cdn.jsdelivr.net/npm/badfilter-js@2.0.13/dist/badword.min.js"></script> <!-- or --> <script type="module" src="https://cdn.jsdelivr.net/npm/badfilter-js@2.0.13/js/badword.min.js"></script> <script> const badfilter = new FilterBadWord("FUck master"); console.log(badfilter.clean(badfilter.position())); // Output: ***** master </script>
For backend or CLI usage:
const { FilterBadWord, filters_badword } = require('badfilter-js'); // Basic usage const badfilter = new FilterBadWord("FUck master"); console.log(badfilter.clean(badfilter.position())); // Output: ***** master
A more concise class for common use cases:
const badfilt = new filters_badword(); // Customize filter rules badfilt.config(true, true, "dict|kick|chicky hu", "stupid|badly"); // Set input text badfilt.text_o("kick master fck"); console.log(badfilt.cleans); // Output: **** master *** console.log(badfilt.position()); // Get positions of filtered words
We're constantly improving BadFilter.js! Here’s what’s new in the latest version:
The text_o() and related text processing methods have been refactored for better clarity, performance, and consistency—especially with large and multilingual text. Expect more stable and readable results.
We’ve introduced intelligent fuzzy matching to catch disguised or creatively-written offensive words such as:
- "f@ck", "f*ck", "phuck", "fucc", etc.
This makes BadFilter.js far more effective in real-world, unstructured user input.
The FilterBadWord class now comes with a flexible options configuration, letting you control how the filter behaves:
options = { filterUrls: false, // Whether to filter offensive words inside URLs filterEmails: false, // Whether to filter inside email addresses contextSensitivity: 2, // Number of surrounding words checked (range: 0–5) filterSeverity: 2, // Level of strictness: 1 = light, 2 = medium, 3 = strict replaceChar: '*', // Character used to replace offensive terms preserveFirstLast: false, // Whether to preserve first/last letters of censored words preserveLength: true, // Keep word length after filtering detectMissingChars: true, // Enable detection of disguised/missing characters ignoreLastDigits: 0 // Ignore trailing numbers in a word (useful for usernames/IDs) };
This update enables nuanced handling of sensitive content, ensuring flexibility across different platforms, audiences, and use cases.
Combining NLP and ML ensures the filter becomes smarter with each use—adapting to new slangs and obscure terms. Stop even the sneakiest of offenders!
Tailor the filter to fit your app’s tone and community standards. Whether you want lenient or strict filtering, it's just a config away.
Performance matters. BadFilter.js is designed to be lightning fast, even under large text loads, keeping your app running smoothly.
- ✅ Accuracy: Industry-grade detection using fuzzy logic and contextual awareness.
- 🔧 Configurability: Powerful tuning options for filtering behavior.
- 💬 Safety First: Build inclusive communities free from toxicity and hate speech.
Perfect for chats, forums, social apps, education platforms, or any user-generated content.
With BadFilter.js, you're equipped to fight toxicity with precision and speed. Say goodbye to offensive language and hello to a clean, inclusive experience for everyone. 🧼✨
Start filtering today and join the movement toward a better, more respectful web. 🌐🚀