# Profanity Filter (Bulk, Multi-Language, Leetspeak-Aware) (`nibble/profanity-content-filter`) Actor

Flag or mask profanity & offensive language in bulk text. Catches leetspeak, unicode & spaced obfuscation. Custom wordlist + allowlist. No API keys. Pay per record.

- **URL**: https://apify.com/nibble/profanity-content-filter.md
- **Developed by:** [Simon Fletcher](https://apify.com/nibble) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 record scanneds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Profanity Content Filter

**Flag or mask profanity and offensive language in bulk text — and actually catch the obfuscated stuff.** This Actor scans thousands of user-supplied text records (reviews, comments, chat logs, form submissions, product listings) and returns clean, agent-friendly JSON: masked text plus a precise per-record **hit list** (term, matched substring, category, language, character offsets). It normalizes **leetspeak, unicode look-alikes, spacing, and stretched letters**, so `sh1t`, `s h i t`, `ｓｈｉｔ`, and `shiiit` are all caught — not just the dictionary spelling.

It runs entirely on the text **you** provide inline. It scrapes nothing, needs no API key or login, and stores no third-party data — so it never breaks when a website changes and carries no scraping-ToS risk.

### Why use Profanity Content Filter?

- **Moderation at scale** — screen user-generated content (reviews, comments, support tickets, usernames) before it goes live.
- **Beats naive word lists** — obfuscation-aware normalization defeats the common tricks (`f4ggot`, `@ss`, `b u l l s h i t`) that simple `str.contains` filters miss.
- **Low false positives** — a word-boundary guard fixes the classic "Scunthorpe problem": `class`, `assessment`, and `passed` are **not** flagged for containing `ass`.
- **Multi-language** — built-in English, Spanish, French, and German lists, extensible per run.
- **Fully tunable** — add your own banned terms with a **custom wordlist**, and whitelist safe words (brand names, surnames) with an **allowlist**.
- **Agent- & pipeline-ready** — concise structured JSON, one record in → one record out, callable via API, schedule, or the Apify MCP server.

### How to use Profanity Content Filter

1. Click **Try for free**.
2. In the **Input** tab, paste your text records into `records` — either plain strings or `{ "id": "...", "text": "..." }` objects (use `id` to map results back to your rows).
3. (Optional) Choose **Action** (`mask` or `flag`), set a **mask character**, restrict **languages**/**categories**, or supply a **custom wordlist** / **allowlist**.
4. Click **Start** and read the results in the **Output** tab, or pull them from the dataset via API/integration.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `records` (required) | array | Text to scan: strings or `{id, text}` objects. |
| `action` | string | `mask` (default) rewrites offending text; `flag` reports only. |
| `maskChar` | string | Character used for masking (default `*`). |
| `languages` | array | Subset of `en`, `es`, `fr`, `de` (default: all). |
| `categories` | array | Subset of `profanity`, `sexual`, `insult`, `slur` (default: all). |
| `customWordlist` | array | Extra terms to flag (reported as category `custom`). |
| `allowlist` | array | Terms that must never be flagged. |
| `maxRecords` | integer | Optional cap on records processed (0 = no cap). |

#### Input example

```json
{
  "records": [
    "You sh1t, that was a b4stard move",
    "what a s h i t experience",
    { "id": "review-42", "text": "Great seller, fast shipping!" }
  ],
  "action": "mask",
  "allowlist": ["scunthorpe"]
}
````

### Output

Each input record produces exactly one dataset item. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
{
  "id": "review-42",
  "text": "You sh1t, that was a b4stard move",
  "cleaned": "You ****, that was a ******* move",
  "hasProfanity": true,
  "hitCount": 2,
  "hits": [
    { "term": "shit", "match": "sh1t", "category": "profanity", "language": "en", "start": 4, "end": 8 },
    { "term": "bastard", "match": "b4stard", "category": "insult", "language": "en", "start": 21, "end": 28 }
  ],
  "categories": ["insult", "profanity"],
  "status": "scanned",
  "charged": true
}
```

#### Output fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | string/int | Your record id, or its array index. |
| `text` | string | Original input text. |
| `cleaned` | string | Masked text (or original, in `flag` mode). |
| `hasProfanity` | boolean | Whether any offensive term was found. |
| `hitCount` | integer | Number of distinct terms detected. |
| `hits` | array | Per-match `{term, match, category, language, start, end}`. |
| `categories` | array | Sorted unique categories present. |
| `status` | string | `scanned`, `empty`, or `error`. |
| `charged` | boolean | Whether this record was billed. |

### Pricing

This Actor uses **pay-per-result**: you are billed **once per non-empty record scanned**. Blank/whitespace rows and any record that errors are **never charged**, and the Actor honors your run's max-charge limit — it stops billing before doing unpaid work. Because it is pure text processing (no proxies, no browser), compute cost per record is tiny; see the Actor's pricing on this page for the current per-record rate.

### Tips & advanced options

- **Reduce false positives** by adding safe words (brand names, surnames, place names) to `allowlist`.
- **Tighten or widen scope** with `categories` — e.g. flag only `slur` for a strict hate-speech gate, or only `profanity` for a mild filter.
- **Localize** by setting `languages` to just the locales you serve.
- **Correlate results** by passing `{ "id": ..., "text": ... }` objects so every output row carries your own key.
- **Cost guard**: combine `maxRecords` with the run's max-charge limit for hard spend control on large batches.

### FAQ, disclaimers & support

- **Does it catch obfuscation?** Yes — leetspeak (`1→i`, `4→a`, `@→a`, `$→s`), full-width/unicode letters, separators (`s h i t`, `s.h.i.t`), and stretched letters (`shiiit`).
- **Will it flag `Scunthorpe` or `assessment`?** No. A word-boundary check prevents substring false positives; use the `allowlist` for any remaining edge cases specific to your domain.
- **Is my data stored or sent anywhere?** No. The Actor processes only the text you pass in and writes results to your own dataset. It performs no scraping and requires no credentials.
- **Can I add my own banned words?** Yes — `customWordlist` (per run). For a tailored/enterprise list or a language not yet covered, use the **Issues** tab to request it.

Found a gap or a false positive? Please open an issue via the **Issues** tab with an example — it helps improve the wordlists.

# Actor input Schema

## `records` (type: `array`):

The text records to scan. Each item is either a plain string OR an object { "id": <any>, "text": "..." }. Provide an id to correlate results back to your own rows; otherwise the array index is used. This Actor scans only the text you supply here — it fetches nothing and stores no third-party data.

## `action` (type: `string`):

What to do with detected profanity. 'mask' replaces offending characters in the cleaned text; 'flag' leaves the text unchanged and only reports hits. Both modes always return the full hit list.

## `maskChar` (type: `string`):

Single character used to replace each offending letter when action is 'mask'. Separators inside a spaced obfuscation (e.g. the spaces in 's h i t') are preserved.

## `languages` (type: `array`):

Which built-in language packs to enable. Leave empty to use all. Options: en (English), es (Spanish), fr (French), de (German).

## `categories` (type: `array`):

Which offense categories to flag. Leave empty for all. Options: profanity, sexual, insult, slur.

## `customWordlist` (type: `array`):

Extra terms to flag in addition to the built-in lists (e.g. brand-specific banned words). Reported under category 'custom'. Obfuscation normalization applies to these too.

## `allowlist` (type: `array`):

Terms that must NEVER be flagged, even if they match a built-in or custom term (e.g. a surname like 'Dick' or a brand name). Matching is case- and obfuscation-insensitive.

## `maxRecords` (type: `integer`):

Optional hard cap on how many records to process this run (0 or empty = no cap). Useful as a cost guard alongside the run's max-charge limit.

## Actor input object example

```json
{
  "records": [
    "total ｆｕｃｋ up"
  ],
  "action": "mask",
  "maskChar": "*",
  "languages": [
    "en",
    "es",
    "fr",
    "de"
  ],
  "categories": [
    "profanity",
    "sexual",
    "insult",
    "slur"
  ]
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "records": [
        "This product is absolute crap and a damn waste of money",
        "You sh1t, that was a b4stard move",
        "what a s h i t experience",
        {
            "id": "review-42",
            "text": "Great seller, fast shipping, no complaints!"
        }
    ],
    "languages": [
        "en",
        "es",
        "fr",
        "de"
    ],
    "categories": [
        "profanity",
        "sexual",
        "insult",
        "slur"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nibble/profanity-content-filter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "records": [
        "This product is absolute crap and a damn waste of money",
        "You sh1t, that was a b4stard move",
        "what a s h i t experience",
        {
            "id": "review-42",
            "text": "Great seller, fast shipping, no complaints!",
        },
    ],
    "languages": [
        "en",
        "es",
        "fr",
        "de",
    ],
    "categories": [
        "profanity",
        "sexual",
        "insult",
        "slur",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("nibble/profanity-content-filter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "records": [
    "This product is absolute crap and a damn waste of money",
    "You sh1t, that was a b4stard move",
    "what a s h i t experience",
    {
      "id": "review-42",
      "text": "Great seller, fast shipping, no complaints!"
    }
  ],
  "languages": [
    "en",
    "es",
    "fr",
    "de"
  ],
  "categories": [
    "profanity",
    "sexual",
    "insult",
    "slur"
  ]
}' |
apify call nibble/profanity-content-filter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nibble/profanity-content-filter",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Profanity Filter (Bulk, Multi-Language, Leetspeak-Aware)",
        "description": "Flag or mask profanity & offensive language in bulk text. Catches leetspeak, unicode & spaced obfuscation. Custom wordlist + allowlist. No API keys. Pay per record.",
        "version": "0.0",
        "x-build-id": "vL9FHcqc3RCi9c48d"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nibble~profanity-content-filter/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nibble-profanity-content-filter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nibble~profanity-content-filter/runs": {
            "post": {
                "operationId": "runs-sync-nibble-profanity-content-filter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nibble~profanity-content-filter/run-sync": {
            "post": {
                "operationId": "run-sync-nibble-profanity-content-filter",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "records"
                ],
                "properties": {
                    "records": {
                        "title": "Text records",
                        "type": "array",
                        "description": "The text records to scan. Each item is either a plain string OR an object { \"id\": <any>, \"text\": \"...\" }. Provide an id to correlate results back to your own rows; otherwise the array index is used. This Actor scans only the text you supply here — it fetches nothing and stores no third-party data."
                    },
                    "action": {
                        "title": "Action",
                        "enum": [
                            "mask",
                            "flag"
                        ],
                        "type": "string",
                        "description": "What to do with detected profanity. 'mask' replaces offending characters in the cleaned text; 'flag' leaves the text unchanged and only reports hits. Both modes always return the full hit list.",
                        "default": "mask"
                    },
                    "maskChar": {
                        "title": "Mask character",
                        "type": "string",
                        "description": "Single character used to replace each offending letter when action is 'mask'. Separators inside a spaced obfuscation (e.g. the spaces in 's h i t') are preserved.",
                        "default": "*"
                    },
                    "languages": {
                        "title": "Languages",
                        "type": "array",
                        "description": "Which built-in language packs to enable. Leave empty to use all. Options: en (English), es (Spanish), fr (French), de (German).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "categories": {
                        "title": "Categories",
                        "type": "array",
                        "description": "Which offense categories to flag. Leave empty for all. Options: profanity, sexual, insult, slur.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "customWordlist": {
                        "title": "Custom wordlist",
                        "type": "array",
                        "description": "Extra terms to flag in addition to the built-in lists (e.g. brand-specific banned words). Reported under category 'custom'. Obfuscation normalization applies to these too.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "allowlist": {
                        "title": "Allowlist",
                        "type": "array",
                        "description": "Terms that must NEVER be flagged, even if they match a built-in or custom term (e.g. a surname like 'Dick' or a brand name). Matching is case- and obfuscation-insensitive.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxRecords": {
                        "title": "Max records (cap)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Optional hard cap on how many records to process this run (0 or empty = no cap). Useful as a cost guard alongside the run's max-charge limit."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
