> ## Documentation Index
> Fetch the complete documentation index at: https://docs.freestylevoice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Profanity Filter

> Swap curse words for wholesome, lighthearted stand-ins as you dictate.

The Profanity Filter plugin keeps your dictation family-friendly — and funnier. Curse words are swapped for wholesome stand-ins on the fly.

> "what the hell is this damn thing" → "what the heck is this dang thing"
>
> "are you shitting me" → "are you shooting me"
>
> "son of a bitch" → "son of a biscuit"

## Install

```bash theme={null}
npm install @freestyle-voice/profanity-filter
```

Or install from **Settings → Plugins** inside the app.

## How it works

A deterministic text rewrite on the server's `afterCleanup` hook — the final text-rewrite stage, same place as dictionary replacement. No LLM, no added latency.

* **Word-boundary matching** — case-insensitive, so "class" and "hello" are never touched.
* **Phrase priority** — multi-word phrases beat their component words ("son of a bitch" → "son of a biscuit", not "son of a meanie").
* **Case mirroring** — "SHIT" → "SUGAR", "Damn" → "Dang".
* **Variety** — where a word has several alternatives, repeats cycle through them.

Identity-based slurs are intentionally **not** included — this is a playful filter, not a euphemism generator for those.

## UI page

The plugin adds a **Profanity Filter** page to the app sidebar (shown once the plugin is enabled). It's a full editor for the word list, so you don't need to touch config or restart the app to change what gets swapped. The page lets you:

* **Add** a word or phrase with one or more replacements (repeats cycle through them)
* **Edit** the replacements for any existing word inline
* **Delete** words you don't want filtered
* **Search** the list
* **Reset to defaults** to restore the built-in list

Every change is saved through the `window.freestyle` host bridge to the plugin's own CRUD endpoint and persisted with plugin storage, so it survives restarts and takes effect on the next dictation.

## Configuration

The word list is managed from the UI page above. The only static option is `preserveCase`, set via the `[name, options]` tuple form in the `plugins` setting:

```jsonc theme={null}
[
  ["@freestyle-voice/profanity-filter", {
    "preserveCase": true
  }]
]
```

| Option         | Type      | Default | Description                                                                                     |
| -------------- | --------- | ------- | ----------------------------------------------------------------------------------------------- |
| `preserveCase` | `boolean` | `true`  | Mirror the matched word's casing onto the replacement (e.g. `SHIT` → `SUGAR`, `Damn` → `Dang`). |

## Build from source

```bash theme={null}
pnpm install
pnpm --filter @freestyle-voice/profanity-filter build
```

This runs `pkgroll --minify` (server-side plugin code) followed by `vite build` (UI page).

## Source

[`plugins/profanity-filter/`](https://github.com/freestyle-voice/freestyle/tree/main/plugins/profanity-filter) in the monorepo.
