Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/bright-languages-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"profanity-kit": minor
---

Revise and expand the reviewed English and Indonesian dictionaries, adding
new entries and removing excluded variants to improve language-pack quality.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ To change an existing language dictionary:

To add a new language pack:

- Open an issue before beginning substantial corpus work so scope and review
expectations can be agreed first.
- Create `dictionaries/<language>/words.txt` and `metadata.json`.
- Run `pnpm dictionary:generate` to create the generated module.
- Add `packages/profanity-kit/src/languages/<language>.ts` and expose it in
Expand Down
53 changes: 35 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a href="https://github.com/up2dul/profanity-kit/actions/workflows/quality.yaml"><img src="https://github.com/up2dul/profanity-kit/actions/workflows/quality.yaml/badge.svg" alt="Quality"></a>
<a href="https://github.com/up2dul/profanity-kit/blob/main/LICENSE"><img src="https://img.shields.io/github/license/up2dul/profanity-kit" alt="MIT License"></a>
<img src="https://img.shields.io/badge/node-%3E%3D22.13.0-339933?logo=node.js&logoColor=white" alt="Node.js 22.13.0 or newer">
<img src="https://img.shields.io/badge/status-pre--release-f59e0b" alt="Pre-release">
<a href="https://www.npmjs.com/package/profanity-kit"><img src="https://img.shields.io/npm/v/profanity-kit" alt="npm version"></a>
</p>

<p align="center">
Expand All @@ -23,31 +23,43 @@
<a href="https://github.com/up2dul/profanity-kit">GitHub</a>
</p>

Profanity Kit provides predictable, synchronous word filtering without a
moderation service or an opaque machine-learning model. It is a deterministic
profanity detection toolkit, not a contextual moderation or toxicity
classifier.
Profanity Kit is a language-pack-based profanity detection toolkit built for
multilingual applications. Select and combine only the languages you need, or
provide custom packs for specific communities. English and Indonesian packs
are available today, with **more built-in languages coming soon!**

It provides predictable, synchronous word filtering without a moderation
service or an opaque machine-learning model. It is a deterministic profanity
detection toolkit, not a contextual moderation or toxicity classifier.

## Why Profanity Kit?

- Unicode-aware, whole-word matching
- Explicit, bundle-friendly language packs
- Built-in English and Indonesian packs, with more languages planned
- Explicit, bundle-friendly multilingual configuration
- Detailed match metadata with source offsets
- Immutable detector configuration
- Synchronous and runtime agnostic
- Zero runtime dependencies

## Installation
## Available languages

> Profanity Kit is in pre-release. The `next` channel will become available
> during the release rehearsal.
| Language | Import |
| ---------- | ---------------------------- |
| English | `profanity-kit/languages/en` |
| Indonesian | `profanity-kit/languages/id` |

| Package manager | Command |
| --------------- | -------------------------------- |
| npm | `npm install profanity-kit@next` |
| pnpm | `pnpm add profanity-kit@next` |
| Yarn | `yarn add profanity-kit@next` |
| Bun | `bun add profanity-kit@next` |
Language packs can be used independently or combined in one detector. Custom
packs support additional languages and communities.

## Installation

| Package manager | Command |
| --------------- | --------------------------- |
| npm | `npm install profanity-kit` |
| pnpm | `pnpm add profanity-kit` |
| Yarn | `yarn add profanity-kit` |
| Bun | `bun add profanity-kit` |

## Quick start

Expand All @@ -62,18 +74,23 @@ detector.check("This contains shit"); // true
detector.filter("Hide the shit"); // "Hide the ****"
```

Use the dictionary-free core when selecting another language explicitly:
Use the dictionary-free core to combine the built-in English and Indonesian
language packs:

```ts
import { createDetector } from "profanity-kit/core";
import { english } from "profanity-kit/languages/en";
import { indonesian } from "profanity-kit/languages/id";

const detector = createDetector({ languages: [indonesian] });
const detector = createDetector({ languages: [english, indonesian] });

detector.check("This contains shit"); // true
detector.check("Dasar goblok"); // true
detector.filter("Dasar goblok"); // "Dasar ******"
```

Load either pack independently when only one language is needed, or supply a
custom language pack for another language or community.

## Learn more

- [Quick Start](https://profanity-kit.up2dul.dev/quick-start)
Expand Down
27 changes: 27 additions & 0 deletions apps/docs/src/content/docs/core-concepts/languages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ sidebar:
Profanity Kit separates its detector engine from language dictionaries. Choose
the entry point based on who should control the language data.

English and Indonesian are available as built-in language packs today. You can
use either independently, combine both for multilingual input, or provide a
custom pack for another language or community.

## Available languages

| Language | Import |
| ---------- | ---------------------------- |
| English | `profanity-kit/languages/en` |
| Indonesian | `profanity-kit/languages/id` |

## Choose an entry point

| Import | Dictionaries | Best for |
| -------------------- | -------------------------- | ----------------------------------------------------------------- |
| `profanity-kit` | English included | English-only applications and shortest setup |
Expand Down Expand Up @@ -82,3 +95,17 @@ selection or bundle composition should be explicit.
You can also supply a custom [`LanguagePack`](/api/types#languagepack).
See [Customization](/guides/customization#create-a-custom-language-pack)
for a complete example.

## More languages

More built-in language packs are planned, but there is no committed language
list or release schedule. Until a built-in pack is available, applications can
provide a custom language pack through the same core API.

Native speakers and community reviewers are welcome to propose or contribute a
new built-in pack. Open a
[GitHub issue](https://github.com/up2dul/profanity-kit/issues) before beginning
substantial corpus work, then follow the
[contribution guide](https://github.com/up2dul/profanity-kit/blob/main/CONTRIBUTING.md#dictionary-contributions)
and
[dictionary review policy](https://github.com/up2dul/profanity-kit/blob/main/dictionaries/README.md).
23 changes: 18 additions & 5 deletions apps/docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
title: Profanity Kit
description: A small, Unicode-aware profanity detector for TypeScript.
description: A multilingual, Unicode-aware profanity detector for TypeScript.
sidebar:
order: 1
badge: Start here
---

## Introduction

Profanity Kit is a TypeScript toolkit for detecting configured profane words as
complete, Unicode-aware tokens. It provides detection mechanisms, language
dictionaries, and customization primitives—not a universal list that every
application must reject.
Profanity Kit is a language-pack-based TypeScript toolkit built for multilingual
applications. Select and combine only the languages you need, or provide custom
packs for specific communities. English and Indonesian packs are available
today, with more built-in packs planned.

It detects configured profane words as complete, Unicode-aware tokens and
provides customization primitives—not a universal list that every application
must reject.

"Profanity" commonly means language considered offensive or taboo in a social
context; its meaning and impact vary by community and situation. See the
Expand Down Expand Up @@ -39,4 +43,13 @@ That variation is why dictionaries stay explicit and detectors immutable.
Try matching interactively
</div>
</a>
<a
href="/core-concepts/languages"
class="block rounded-lg border border-border p-4 transition-colors hover:border-border-strong no-underline"
>
<div class="font-medium text-foreground">Languages & Dictionaries</div>
<div class="mt-0.5 text-sm text-muted-foreground">
Use English, Indonesian, or custom packs
</div>
</a>
</div>
23 changes: 22 additions & 1 deletion apps/docs/src/content/docs/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,28 @@ detector.filter("hide the shit"); // "hide the ****"
```

`findAll()` returns ordered match details when you need offsets or language
codes. Next, choose [languages](/core-concepts/languages) or learn [matching](/core-concepts/matching).
codes.

## Combine languages

Profanity Kit includes built-in English and Indonesian packs. Import the
dictionary-free core to use either pack independently or combine them in one
detector:

```ts
import { createDetector } from "profanity-kit/core";
import { english } from "profanity-kit/languages/en";
import { indonesian } from "profanity-kit/languages/id";

const detector = createDetector({ languages: [english, indonesian] });

detector.check("This contains shit"); // true
detector.check("Dasar goblok"); // true
```

See [Languages & Dictionaries](/core-concepts/languages) to select one pack,
combine packs, or create a custom pack. You can also learn how
[matching works](/core-concepts/matching).

## Compatibility

Expand Down
4 changes: 2 additions & 2 deletions dictionaries/en/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"code": "en",
"name": "English",
"version": "0.2.0",
"version": "0.3.0",
"source": "project-curated",
"license": "MIT",
"retrievedAt": "2026-08-31",
"retrievedAt": "2026-09-13",
"reviewStatus": "human-reviewed",
"reviewer": "project-maintainers"
}
Loading
Loading