Skip to content

Analyze Text

Classify text — sentiment, toxicity, or moderation — locally in your browser (DistilBERT-SST2, toxic-bert on transformers.js). Private, offline, no cost.

Runs the text through the selected on-device classifier and returns the matching labels with confidence scores, filtered by a threshold and capped to the top results.

Moderate user-generated content, gauge feedback tone, or gate a workflow branch on toxicity — without sending the text to a third-party API.

SettingNotes
ModelAny installed text-moderation model, across engines.
TextThe text to analyze.
Confidence thresholdDrop labels below this score (default 0).
Top-K labelsKeep at most this many labels (default 5).

Returns { predictions, top, score }:

  • predictions — array of { label, score }, highest first.
  • top — the highest-scoring label (or null).
  • score — that label’s score.