-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Side ID ~ edited this page Apr 15, 2025
·
2 revisions
- ๐ [Home](#overview)
-
๐ฆ Getting Started
- [Installation](#installation)
- [Basic Usage](#basic-usage)
-
โ๏ธ Configuration
- [Advanced Configuration](#advanced-configuration)
- [Presets](#presets)
-
๐ API
- [API Reference](#api-reference)
- [Methods Overview](#main-methods)
-
๐ Language Support
- [Regional Support](#regional-support)
- [Word Categories](#categories)
-
๐ค Community
- [Contributing](#contributing)
- [Support](#support)
- ๐ [License](#license)
- [Overview](#overview)
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Advanced Configuration](#advanced-configuration)
- [API Reference](#api-reference)
- [Presets](#presets)
- [Regional Support](#regional-support)
- [Categories](#categories)
- [Contributing](#contributing)
- [License](#license)
ID-Profanity-Filter is a comprehensive JavaScript/TypeScript library designed to detect, censor, and analyze profane words in Indonesian and regional languages. The library provides advanced features for content moderation and text filtering.
- ๐ Profanity Detection: Identifies offensive words in Indonesian text
โ ๏ธ Content Analysis: Analyzes severity and categories of profane words- ๐ Censorship: Offers customizable word censoring options
- ๐บ๏ธ Regional Language Support: Covers words from various Indonesian regions
- ๐ง Smart Detection: Identifies spelling variations, split words, and word similarities
- ๐ Levenshtein Detection: Detects modified or obfuscated profane words
- ๐ก๏ธ Presets: Ready-to-use filter presets
- ๐ง Customization: Options to add whitelist and custom word lists
Install the library using your preferred package manager:
npm install @sideid/id-profanity-filter
# or
yarn add @sideid/id-profanity-filter
# or
pnpm add @sideid/id-profanity-filter
import IDProfanityFilter from '@sideid/id-profanity-filter';
// Create a filter instance
const filter = new IDProfanityFilter();
// Check for profanity
const text = 'Dasar anjing kamu, jangan banyak bacot!';
const hasProfanity = filter.isProfane(text);
console.log(hasProfanity); // Output: true
// Filter profane words
const result = filter.filter(text);
console.log(result.filtered);
// Output: "Dasar ***** kamu, jangan banyak *****!"
const filter = new IDProfanityFilter({
replaceWith: '#',
fullWordCensor: false,
detectLeetSpeak: true,
categories: ['sexual', 'slur'],
regions: ['jawa', 'general'],
severityThreshold: 0.7,
// Advanced options
useRandomGrawlix: true,
keepFirstAndLast: true,
indonesianVariation: true,
detectSimilarity: true,
detectSplit: true,
useLevenshtein: true
});
-
filter(text: string)
: Censors profane words -
isProfane(text: string)
: Checks if text contains profanity -
analyze(text: string)
: Provides detailed analysis of profane content -
batchAnalyze(texts: string[])
: Analyzes multiple texts -
analyzeBySentence(text: string)
: Analyzes text by sentence -
analyzeWithContext(text: string)
: Analyzes text with surrounding context
- strict: Most rigorous filtering
- moderate: Medium-level filtering
- light: Minimal filtering
- childSafe: Extremely strict filtering
- sexual: Sexual content
- insults: Insulting words
- profanity: General profanity
- general: General Indonesian words
- jawa: Javanese words
- sunda: Sundanese words
- betawi: Betawi words
- batak: Batak words
The library supports profane words from various Indonesian regions:
- ๐ฎ๐ฉ General Indonesian
- ๐๏ธ Javanese
- ๐๏ธ Sundanese
- ๐๏ธ Betawi
- ๐ Batak
Words are categorized into:
-
sexual
: Sexual content -
insult
: Insulting words -
profanity
: General profanity -
slur
: Derogatory terms -
drugs
: Drug-related terms -
disgusting
: Offensive words -
blasphemy
: Religious insults
We welcome contributions! To contribute:
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
To add a new word to the database, create a pull request with changes in src/constants/categories/
or src/constants/regions/
:
{
"word": "profane_word",
"category": "insult",
"region": "general",
"severity": 0.7,
"aliases": ["variations"],
"description": "Word explanation",
"context": "Usage context"
}
This project is licensed under the MIT License. See the LICENSE file for details.
For questions, issues, or suggestions, please open an issue in the GitHub repository.