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_thresholdto 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
| Parameter | Type | Required | Description | Default | Constraints |
|---|---|---|---|---|---|
| model | string | Yes | HuggingFace hub ID (e.g. 'mrm8488/bert-tiny-finetuned-sms-spam-detection') or absolute local directory path. | — | — |
| model_revision | string | No | Git branch, tag, or commit hash when fetching from the HuggingFace hub. | null | — |
| device | string | No | Inference device: 'cpu' (default), 'cuda', 'mps', or a CUDA device string like 'cuda:0'. | cpu | — |
| top_k | integer | No | Maximum number of top predictions to return. When null all labels above confidence_threshold are returned. | null | — |
| function_to_apply | string | No | Score normalization: 'softmax' for single-label, 'sigmoid' for multi-label, 'none' for raw logits. | null | — |
| confidence_threshold | number | No | Minimum prediction confidence to report a label as a finding (0-1). | 0.7 | min 0, max 1 |
| severity | string | No | Default severity when no severity_map rule matches. | info | — |
| severity_map | array | No | Ordered rules mapping predicted labels to severity levels. First matching rule wins. | null | — |
| max_length | integer | No | Override the tokenizer's maximum sequence length. | null | — |
| chunk_size | integer | No | Split text into chunks of this many characters before classification. | null | — |
| chunk_overlap | integer | No | Character 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" }
]
}