anti-ttyah
v0.2.0
Published
Content filter for Arabic, French, English, and Tamazight — including Franco-arabe digit-speak.
Maintainers
Readme
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: ben-coderr.github.io/Anti-Ttyah
Install
npm i anti-ttyahZero 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.
لم نذكر الكلمات الحقيقية هنا احتراماً للقارئ.
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" } | nullExtend or soften the default list without forking:
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
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 comments.txt
echo "text" | npx anti-ttyahExit 1 if blocked — useful in CI.
Why not bad-words?
| | typical EN filter | Anti-Ttyah |
| --- | --- | --- |
| English | yes | yes |
| French | sometimes | yes |
| Arabic (script + Latin chat) | no | yes |
| Franco-arabe digits (3/7/9) | no | yes |
| Tamazight | no | conservative list |
| Runs offline | yes | yes |
Normalization includes: tashkeel/tatweel strip, أ/إ/آ → ا, ة → ه, repeat collapse (n*kkk → n*k), article prefixes (el / ال), and separator folding (z.e.b.i).
Wordlist
The default list covers Arabic, Franco-arabe, French, English, and Tamazight. Counts are exported as WORDLIST_STATS (including byLang and byCategory). Add project-specific terms with createFilter rather than opening a PR for every local insult.
Scripts
npm test
npm run build
npm run docs:devLicense
MIT. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Français
Filtre de contenu arabe, franco-arabe, français, anglais et tamazight. Aucun appel réseau. npm i anti-ttyah
Nous n’affichons pas les vrais mots listés ici, par respect pour le lecteur.
Docs : https://ben-coderr.github.io/Anti-Ttyah/
العربية
فلتر محتوى للعربية والفرانكو-عرب والفرنسية والإنجليزية والأمازيغية. يعمل محلياً بدون واجهة برمجية خارجية.
لم نذكر الكلمات الحقيقية هنا احتراماً للقارئ.
التوثيق: https://ben-coderr.github.io/Anti-Ttyah/
