glin-profanity
Profanity detection and content moderation library with leetspeak, Unicode homoglyph, and ML-powered detection. Use when filtering user-generated content, moderating comments, checking text for profanity, censoring messages, or building content moderation into applications.
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Profanity detection and content moderation library with leetspeak, Unicode homoglyph, and ML-powered detection. Use when filtering user-generated content, moderating comments, checking text for profanity, censoring messages, or building content moderation into applications. Supports 24 languages.
How to use
Zainstaluj bibliotekę za pomocą npm (dla JavaScript/TypeScript) poleceniem npm install glin-profanity, lub pip install glin-profanity dla Pythona.
Zaimportuj funkcje lub klasę Filter z biblioteki — w JavaScript użyj import { checkProfanity, Filter } from 'glin-profanity', w Pythonie from glin_profanity import Filter.
Utwórz instancję Filter z konfiguracją — określ język (np. english), znak zastępczy (replaceWith lub replace_with), oraz włącz detectLeetspeak i normalizeUnicode, aby łapać zakamuflowane formy.
Sprawdzaj tekst metodą checkProfanity() lub isProfane() — metoda zwróci boolean (czy tekst zawiera wulgaryzmów) oraz tablicę wykrytych słów i wersję tekstu z cenzurą.
W React użyj hooka useProfanityChecker, przekaż opcje (np. detectLeetspeak: true), a następnie wywołuj checkText() w onChange inputu — hook zwróci wynik i funkcję do sprawdzania.
Obsługuj wynik — wykorzystaj pole containsProfanity do podjęcia decyzji (zaakceptuj/odrzuć tekst), profaneWords do logowania, processedText do wyświetlenia cenzurowanej wersji.