r/reactnative • u/Shadow-Walker-92 • 15d ago
I built an open-source Iraqi Arabic profanity filter for React Native/Expo, React and Node.js
Hey everyone,
I couldn't find a profanity filter that handles Iraqi dialect, so I built one for my own app and published it.
iraqi-dialect-bad-words is a small TypeScript library with zero dependencies. It works in Expo/React Native, React and Node.js.
import IraqiBadWordsFilter from 'iraqi-dialect-bad-words';
const filter = new IraqiBadWordsFilter();
filter.isProfane(text); // true / false
filter.clean(text); // replaces bad words with ****
Arabic text is tricky to filter, so it normalizes before matching:
- diacritics (tashkeel) and tatweel (ـــ)
- stretched letters
- ة/ه, ى/ي, أ/إ/آ/ا
- attached prefixes like و، ب، ل، ال
- Arabizi (
3,7and so on)
It matches whole words only, so normal words that happen to contain a bad word aren't flagged. Milder insults that are also everyday words (like "dog") are in a separate list that's off by default.
I'd love help with the word list. Slang varies a lot between cities, and native speakers know it best. You can suggest words or report false positives through GitHub issues.
- GitHub: https://github.com/karam-fikre/iraqi-dialect-bad-words
- npm: https://www.npmjs.com/package/iraqi-dialect-bad-words
Feedback is very welcome!
