Reference
CLI Reference
Command-line interface reference for all FastPII commands.
CLI Reference
Installation
The CLI is included with the fastpii package:
pip install fastpiiGlobal options
fastpii --helpCommands
detect
Detect PII in text or a file.
fastpii detect "text to analyze" [OPTIONS]Positional arguments
| Argument | Description |
|---|---|
text | Text to analyze (optional if --file is used) |
Options
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--file | -f | Path | Read text from file | |
--regions | -r | list[str] | Required | Region codes to enable (e.g., cz pl de fr) |
--format | -fmt | json or text | text | Output format |
--output | -o | Path | Write output to file |
Examples
# Basic detection
fastpii detect "Jan Novák, RČ: 8001011238" -r cz
# From file
fastpii detect --file document.txt -r cz
# JSON output
fastpii detect "Email: jan.novak@example.cz" -r cz --format json
# Write to file
fastpii detect "Text with PII" -r cz -o results.json
# Multi-region
fastpii detect "PESEL: 44051401458, Steuer-ID: 86095742719" -r cz pl de frJSON output format
{
"text": "Jan Novák, RČ: 8001011238",
"findings": [
{
"type": "rodne_cislo",
"value": "8001011238",
"start": 10,
"end": 20,
"confidence": 1.0,
"region": "cz",
"metadata": {
"checksum_valid": true,
"birth_date": "1980-01-01",
"gender": "male",
"article_9": true
}
}
],
"detector_names": ["rodne_cislo"],
"processing_time_ms": 1
}validate
Validate a specific identifier.
fastpii validate VALUE --detector DETECTOR_NAME [OPTIONS]Positional arguments
| Argument | Description |
|---|---|
value | Value to validate |
Options
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--detector | -d | str | Required | Detector name to use |
--regions | -r | list[str] | Required | Region codes to enable |
--format | -fmt | json or text | text | Output format |
Examples
# Validate a Czech birth number
fastpii validate 8001011238 --detector rodne_cislo -r cz
# Validate a Polish PESEL
fastpii validate 44051401458 --detector pesel -r pl
# JSON output
fastpii validate 8001011238 --detector rodne_cislo -r cz --format jsonText output format
Validation Result:
Detector: rodne_cislo
Value: 8001011238
Status: ✓ VALID
Metadata:
- checksum_valid: True
- birth_date: 1980-01-01
- gender: malelist-detectors
List available detectors for given regions.
fastpii list-detectors [OPTIONS]Options
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--regions | -r | list[str] | Required | Region codes to enable |
--format | -fmt | json or text | text | Output format |
Examples
# List Czech detectors
fastpii list-detectors -r cz
# List all detectors across regions
fastpii list-detectors -r cz pl de fr
# JSON output
fastpii list-detectors -r cz --format jsonevaluate
Evaluate detectors against a benchmark corpus.
fastpii evaluate --corpus PATH [OPTIONS]Options
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--corpus | Path | Required | Path to corpus directory | |
--output | -o | Path | reports | Output directory for reports |
--regions | -r | list[str] | ["cz"] | Region codes to enable |
--iou-threshold | float | 0.5 | IoU threshold for span matching | |
--fail-on-regression | flag | False | Exit with error code on regression | |
--baseline | Path | Path to previous baseline JSON |
Examples
# Evaluate Czech detectors
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz
# Multi-region evaluation
fastpii evaluate --corpus tests/benchmarks/corpus -r cz pl de fr
# Custom IoU threshold
fastpii evaluate --corpus tests/benchmarks/corpus --iou-threshold 0.7 -r cz
# Fail on regression
fastpii evaluate --corpus tests/benchmarks/corpus --fail-on-regression -r cz
# Compare against baseline
fastpii evaluate --corpus tests/benchmarks/corpus --baseline reports/baseline.json -r czOutput
============================================================
FastPII Evaluation Results
============================================================
Corpus: tests/benchmarks/corpus
Samples: 50
Words: 12000
Precision: 84.20%
Recall: 80.00%
F1: 82.05%
F2: 80.81%
FP/1000w: 3.50
============================================================
Reports saved to reports/
Baseline saved to reports/baseline.json