Logo Lanfrica

Ben-coderr/Anti-Ttyah

Domain:

natural language processing

Record type:

software
Creator:
Ben
Host:
Content filter for Arabic, French, English, and Tamazight. Block or mask. Zero deps. # Anti-Ttyah **Content filter** for Arabic, French, English, and Tamazight — including Franco-arabe digit-speak. English-only libraries miss mixed-script chat and digit-speak (`3` / `7` / `9`). Anti-Ttyah folds those variants before matching, then either **blocks** the text or **masks** the hits. > **Content warning.** This package ships a list of offensive terms. That is the point. Do not paste the wordlist into READMEs, issues, or social posts. **Docs & playground:** English · العربية · Try it --- ## Install ```bash npm i anti-ttyah ``` Zero runtime dependencies. Works in Node 18+ and the browser. ## Library We do not show the real listed words here, out of respect for the reader (`9*ba`). Nous n’affichons pas les vrais mots listés ici, par respect pour le lecteur. لم نذكر الكلمات الحقيقية هنا احتراماً للقارئ. ```ts import { contains, mask, inspect, explain, blockedError, createFilter } from "anti-ttyah"; contains("9*ba"); // true (Franco-arabe) contains("ق*بة"); // true (Arabic script) mask("hello z*bi"); // "hello ****" inspect("ولد الق*بة"); // { blocked: true, hits: [{ start, end, raw, lang, category }] } explain("hello z*bi"); // per-token keys (playground / --explain) blockedError(title, body); // { error: "PROFANITY_BLOCKED" } | null ``` Extend or soften the default list without forking: ```ts const filter = createFilter({ extraTerms: ["customslur"], extraPhrases: ["not allowed"], allowlist: ["h*ar"], // skip a false positive maskChar: "#", maskStyle: "token", // "***" per hit categories: ["sexual", "slur"], }); ``` Aliases kept for drop-in use: `containsProfanity`, `maskProfanity`, `profanityError`. Full reference: API. ## CLI ```bash npx anti-ttyah "bonjour" # clean (exit 0) npx anti-ttyah --mask "hello z*bi" npx anti-ttyah --json "hello z*bi" npx anti-ttyah --explain "hello z*bi" npx anti-ttyah --categories sexual,insult "hello" npx anti-ttyah --file co …