AI Features Coming Soon
    Open Source Ready

    Profanity Detection
    for the Modern Web

    Built for Devs. Tuned for Speed. Trusted by AI.
    Install
    Preview Output
    $ glin scan --fuzzy=0.8 ""
    ➜ Awaiting scan results...

    Try the Profanity Scanner

    Paste or type any content and scan it with one click.

    Advanced Settings

    ✨ Meet the Glin Profanity Bot

    Moderate your Discord server like a pro. The Glin Profanity Bot scans messages in real time, flags offensive content, and adapts to your community rules — all while staying fully open-source and transparent.

    v2.0.0 – Updated for Obfuscation & Async Scans

    Getting Started with Glin-Profanity

    1
    Installation

    Install Glin-Profanity into your project:

    npm install glin-profanity
    yarn add glin-profanity
    2
    Basic Usage

    Quickly scan text in real-time using the useProfanityChecker hook:

    import React, { useState } from 'react';
    import { useProfanityChecker } from 'glin-profanity';
    
    const MyComponent = () => {
      const [text, setText] = useState('');
      const { result, checkText } = useProfanityChecker();
    
      const handleCheck = () => checkText(text);
    
      return (
        <div className="space-y-4">
          <input
            type="text"
            value={text}
            onChange={(e) => setText(e.target.value)}
            placeholder="Type something..."
            className="w-full border rounded px-3 py-2"
          />
          <button
            onClick={handleCheck}
            className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded"
          >
            Check Profanity
          </button>
    
          {result && (
            <div className="mt-2">
              <p>Contains Profanity: <strong>{result.containsProfanity ? 'Yes' : 'No'}</strong></p>
              {result.containsProfanity && (
                <>
                  <p>Flagged Words: <code>{result.profaneWords.join(', ')}</code></p>
                  {result.severityMap && (
                    <ul className="list-disc list-inside text-sm text-gray-600 dark:text-gray-300">
                      {result.profaneWords.map((word, i) => (
                        <li key={i}>
                          <strong>{word}</strong> – Severity: <em>{result.severityMap?.[word] ?? 'N/A'}</em>
                        </li>
                      ))}
                    </ul>
                  )}
                </>
              )}
            </div>
          )}
        </div>
      );
    };

    Displays results, flagged terms, and severity levels for enhanced moderation control.

    3
    Configuration

    Control detection behavior with config options:

    const { result, checkText } = useProfanityChecker({
      allLanguages: true,
      caseSensitive: false,
      wordBoundaries: true,
      allowObfuscatedMatch: true,
      fuzzyToleranceLevel: 0.8,
      severityLevels: true,
      customWords: ['slur1', 'slur2']
    });

    New in v2.0.0: Detect obfuscated profanity like f@ck, enable typo-matching, and return severity ratings. Use checkTextAsync() for async environments.

    4
    Filter Class

    Constructor

    new Filter({
      languages?: Language[],
      allLanguages?: boolean,
      caseSensitive?: boolean,
      wordBoundaries?: boolean,
      allowObfuscatedMatch?: boolean,
      fuzzyToleranceLevel?: number,
      customWords?: string[],
      replaceWith?: string,
      severityLevels?: boolean,
      ignoreWords?: string[],
      logProfanity?: boolean
    });

    Use the Filter class to programmatically scan content (server-side or client-side).

    • languages: Specific languages (e.g., ['en']).
    • allLanguages: Scan in 20+ supported languages.
    • caseSensitive: Respect letter casing.
    • wordBoundaries: Avoid partial matches (e.g., class vs. ass).
    • allowObfuscatedMatch: Catch disguised slurs like a$$, f@ck.
    • fuzzyToleranceLevel: 0.5–1 range to detect typos and near matches.
    • customWords: Add your own flagged terms.
    • replaceWith: Replace matches with *** or similar.
    • severityLevels: Return severity map per term.
    • ignoreWords: Safelist terms to exclude.
    • logProfanity: Log results to console for debugging.

    Recommended for advanced use-cases where React hooks aren’t ideal.

    5
    useProfanityChecker Hook

    A custom React hook for real-time text moderation in components.

    Config Options

    • languages: Array like ['en', 'fr'].
    • allLanguages: Enable detection in all supported languages.
    • caseSensitive: Match case exactly.
    • wordBoundaries: Avoid substring matches.
    • allowObfuscatedMatch: Detect leetspeak & disguised terms.
    • fuzzyToleranceLevel: Typo sensitivity (e.g., 0.8).
    • customWords: Add platform-specific slurs.
    • replaceWith: Mask words in output.
    • severityLevels: Enable severity-based moderation logic.
    • ignoreWords: Whitelist words to exclude from detection.
    • logProfanity: Output matches to console (dev mode).
    • customActions: Run custom logic when a match is found.

    Returns

    • result: Scan result object
    • checkText(): Run a sync scan
    • checkTextAsync(): Run an async scan (e.g., server)
    • reset(): Clear last result
    const {
      result,
      checkText,
      checkTextAsync,
      reset
    } = useProfanityChecker({
      allLanguages: true,
      allowObfuscatedMatch: true,
      fuzzyToleranceLevel: 0.85,
      customWords: ['slur1', 'slur2'],
      severityLevels: true
    });
    6
    Integration

    Getting started with Glin-Profanity takes just a few lines of code. Here's how to integrate it into your workflow:

    1. Install the package with npm or yarn.
    2. Import useProfanityChecker or Filter.
    3. Customize detection options: fuzzy matching, obfuscation, etc.
    4. Use checkText() or checkTextAsync() in forms, APIs, or streams.

    Perfect for content forms, live chats, UGC pipelines, and AI agent moderation.

    7
    Benefits

    Glin-Profanity gives your product superpowers in user protection and quality moderation:

    • 🧠 AI-level Detection: Flags typos, leetspeak, and evasion attempts.
    • 🧩 Custom Filters: Add your own terms, exceptions, or replace rules.
    • 🌐 Global Support: Works in 20+ languages—out of the box.
    • Fast & Flexible: React hook or standalone class—lightweight and async-ready.
    • 🔒 Clean UX: Eliminate offensive input at the source.