induwara.lk
induwara.lkAI · Moderation

AI Toxicity Detector — Check Text for Toxic & Offensive Language

Paste a comment, review, or message and score it across the six Jigsaw toxicity categories. A toxic-bert classifier runs server-side and a transparent lexical heuristic runs alongside it as a cross-check. No signup, no model download to your browser, and nothing is stored.

By Induwara AshinsanaUpdated Jul 13, 2026
Score for toxicitytoxic-bert · server-side
Sources cited
Inference runs server-side. Text is sent once for scoring and not stored.143 / 10,000
Try a sample
0.50

Any category with a probability at or above this value flags the text. Scores within 0.10below the threshold are marked “borderline” — worth a human re-read.

One click runs the unitary/toxic-bert classifier server-side and a lexical heuristic alongside it as a transparent second opinion.

What this does

Reads any English text and scores it across six independent toxicity categories — toxic, severe_toxic, obscene, threat, insult, identity_hate — each a sigmoid probability between 0 and 1. A BERT classifier runs server-side; a lexical heuristic runs alongside as a transparent baseline. For longer passages the worst sentences surface first.

Methodology: BERT-base · 110M parameters · multi-label sigmoid head. Six independent sigmoid heads (toxic, severe_toxic, obscene, threat, insult, identity_hate); verdict at threshold 50% (inclusive ≥). Cross-checked against a deterministic lexical heuristic. Sources linked under “Sources” below.

How it works

The page runs two independent analyses on the same text and shows both side by side. They use very different methods, and watching them agree — or disagree — is the quickest way to judge how much to trust a single reading.

1. Neural model (server-side)

The primary classifier is unitary/toxic-bert, a BERT-base · 110M parameters · multi-label sigmoid head fine-tuned on the Jigsaw Toxic Comment Classification corpus. We call the Hugging Face Inference API from a server-only route handler with the body parameter top_k: null so the response includes every category's probability. Because the heads are independent sigmoids (not a softmax), the six numbers do not sum to 1 — a comment can be both an insult and a threat. Your browser never downloads model weights; it sends text and receives a small JSON result. For multi-sentence input the whole text and each sentence (up to a cap) are scored in one request.

2. Lexical heuristic (cross-check, always on)

The second pass is pure, deterministic JavaScript that never leaves the server. It combines five shape signals, each contributing 0 to 1: the fraction of long words in all-caps (shouting), exclamation-mark density, repeated-letter elongation such as "stuuupid", the directed you are <word> insult pattern, and hits against a small frozen list of 21 mild insult words. The five signals are averaged into one heuristic score, then projected onto the six categories with fixed coefficients so the cross-check is in the same shape as the model output:

heuristicScore = (shout + bang + elongation + directInsult + mildInsult) / 5

category[c] = clamp01(heuristicScore × projection[c])   for each of the 6 heads

This lexicon is intentionally small and public — it is a transparent baseline, not a moderation denylist. It gives the tool a usable floor for obvious cases and, crucially, means a result is still returned when neural inference is not configured on this build.

3. Verdict and aggregation

For multi-sentence text, the document score for each category is the maximum across sentences — one toxic sentence pollutes the document, which matches the aggregation the Detoxify authors recommend. The verdict then follows the flag threshold you set (default 0.50): if any category is at or above it, the text is flagged; if the top category sits within 0.10 below it, the text is borderline and worth a human re-read; otherwise it is clean. The comparison is inclusive (≥), so a score of exactly the threshold flags. Both passes are deterministic given the same input and threshold.

Worked examples

Clean — respectful disagreement

I respectfully disagree with the proposal — the cost model assumes a static exchange rate.

  1. Heuristic: no shouting, no bangs, no elongation, no 'you are' pattern, no insult words
  2. heuristicScore = (0 + 0 + 0 + 0 + 0) / 5 = 0.000
  3. All six categories project to 0.000
  4. Model: toxic ≈ 0.001, insult ≈ 0.001, rest ≈ 0.000
  5. Top score 0.001 < 0.50 threshold → verdict CLEAN (both passes agree)

Flagged — directed insult

That argument is so stupid only an idiot would believe it.

  1. Heuristic insult hits: 'stupid', 'idiot' → mildInsult = clamp01(2 × 0.5) = 1.0
  2. Other signals = 0 → heuristicScore = 1.0 / 5 = 0.200
  3. toxic ≈ 0.200 × 2.5 = 0.500, insult ≈ 0.200 × 2.5 = 0.500 → heuristic FLAGGED at 0.50
  4. Model: toxic ≈ 0.95, insult ≈ 0.93, threat ≈ 0.00 → FLAGGED
  5. Both passes flag; the model is far more confident than the heuristic floor

Flagged — all-caps shouting

SHUT UP RIGHT NOW!!! YOU WILL REGRET THIS.

  1. Shout: 7 of 7 long words all-caps → capsRatio ≥ 0.4 → shoutScore = 1.0
  2. Bang: 3 exclamation marks → bangScore = clamp01(3 / 3) = 1.0
  3. Elongation 0, directInsult 0, mildInsult 0
  4. heuristicScore = (1.0 + 1.0 + 0 + 0 + 0) / 5 = 0.400
  5. toxic ≈ 0.400 × 2.5 → clamps to 1.000, threat ≈ 0.400 × 1.2 = 0.480 → FLAGGED

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a misclassification, edge case, or have a model suggestion?

Email me at [email protected] — most fixes ship within 24 hours.