Skip to Content
DetectorsCustom DetectorsText Classification

Text Classification

Text · HuggingFace · Fine-tuned

The Text Classification detector runs any HuggingFace text-classification pipeline model on asset content. You control the model checkpoint, confidence threshold, and a severity map that translates predicted labels into finding severity levels.

When to use

  • Spam and phishing detection — run a dedicated spam classifier on email content or support tickets.
  • Toxicity and content moderation — flag harmful language in user-generated text before it reaches moderation queues.
  • Sentiment analysis — score feedback, reviews, or support interactions to identify negative patterns.
  • Custom topic labelling — deploy a fine-tuned model trained on your own labelled data to detect domain-specific categories.
  • Confidence-gated findings — use confidence_threshold to surface only high-confidence predictions and reduce noise.

How it works

At scan time, Classifyre loads the specified HuggingFace model (either from the Hub or a local path) and runs the text-classification pipeline on the asset content. The top-k predicted labels above the confidence_threshold become findings. The severity_map translates specific label names to severity levels; unmatched labels fall back to the severity default.

For long documents, set chunk_size to split the text before classification. Each chunk is scored independently; findings reference the originating chunk position.

Configuration

ParameterTypeRequiredDescriptionDefaultConstraints
modelstringYesHuggingFace hub ID (e.g. 'mrm8488/bert-tiny-finetuned-sms-spam-detection') or absolute local directory path.
model_revisionstringNoGit branch, tag, or commit hash when fetching from the HuggingFace hub.null
devicestringNoInference device: 'cpu' (default), 'cuda', 'mps', or a CUDA device string like 'cuda:0'.cpu
top_kintegerNoMaximum number of top predictions to return. When null all labels above confidence_threshold are returned.null
function_to_applystringNoScore normalization: 'softmax' for single-label, 'sigmoid' for multi-label, 'none' for raw logits.null
confidence_thresholdnumberNoMinimum prediction confidence to report a label as a finding (0-1).0.7min 0, max 1
severitystringNoDefault severity when no severity_map rule matches.info
severity_maparrayNoOrdered rules mapping predicted labels to severity levels. First matching rule wins.null
max_lengthintegerNoOverride the tokenizer's maximum sequence length.null
chunk_sizeintegerNoSplit text into chunks of this many characters before classification.null
chunk_overlapintegerNoCharacter overlap between consecutive chunks.0

Examples

SMS spam detection

{
  "type": "TEXT_CLASSIFICATION",
  "model": "mrm8488/bert-tiny-finetuned-sms-spam-detection",
  "confidence_threshold": 0.85,
  "severity_map": [
    { "label": "spam", "severity": "high" }
  ],
  "severity": "info"
}

Toxicity classifier with chunking for long documents

{
  "type": "TEXT_CLASSIFICATION",
  "model": "unitary/toxic-bert",
  "device": "cpu",
  "confidence_threshold": 0.7,
  "chunk_size": 512,
  "chunk_overlap": 64,
  "severity_map": [
    { "label": "toxic", "severity": "high" },
    { "label": "obscene", "severity": "medium" }
  ]
}
Last updated on