Integrations
CLI
Command-line interface for detection, validation, and evaluation.
CLI
FastPII includes a CLI for detection, validation, listing detectors, and benchmark evaluation.
detect
Detect PII in text or a file:
# Basic detection
fastpii detect "Email: jan.novak@example.cz, RČ: 8001011238" -r cz
# From a file
fastpii detect --file document.txt -r cz
# JSON output
fastpii detect "Email: jan.novak@example.cz" -r cz --format json
# Write output to file
fastpii detect "Text here" -r cz --output results.json
# Multi-region
fastpii detect "PESEL: 44051401458, Steuer-ID: 86095742719" -r cz pl de frOptions
| Option | Short | Description |
|---|---|---|
text | Text to analyze (positional) | |
--file | -f | Read text from file |
--regions | -r | Region codes to enable (required) |
--format | -fmt | Output format: json or text (default: text) |
--output | -o | Write output to file |
Text output example
Detected 2 finding(s) in 1ms:
[1] rodne_cislo: 8001011238
Position: 33-43
Region: cz
Confidence: 100.0%
Metadata:
- checksum_valid: True
- birth_date: 1980-01-01
- gender: male
[2] email: jan.novak@example.cz
Position: 7-27
Region: cz
Confidence: 95.0%validate
Validate a single identifier:
# Validate a Czech birth number
fastpii validate 8001011238 --detector rodne_cislo -r cz
# Validate a PESEL
fastpii validate 44051401458 --detector pesel -r pl
# JSON output
fastpii validate 8001011238 --detector rodne_cislo -r cz --format jsonOptions
| Option | Short | Description |
|---|---|---|
value | Value to validate (positional) | |
--detector | -d | Detector to use (required) |
--regions | -r | Region codes to enable (required) |
--format | -fmt | Output format: json or text (default: text) |
Text output example
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:
# List Czech detectors
fastpii list-detectors -r cz
# List multi-region detectors
fastpii list-detectors -r cz pl de fr
# JSON output
fastpii list-detectors -r cz --format jsonOptions
| Option | Short | Description |
|---|---|---|
--regions | -r | Region codes to enable (required) |
--format | -fmt | Output format: json or text (default: text) |
evaluate
Evaluate detectors against a benchmark corpus:
# Evaluate Czech detectors
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz
# Multi-region evaluation
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz pl de fr
# Custom IoU threshold
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz --iou-threshold 0.7
# Fail on regression
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz --fail-on-regression
# Compare against baseline
fastpii evaluate --corpus tests/benchmarks/corpus --output reports -r cz --baseline reports/baseline.jsonOptions
| Option | Short | Description |
|---|---|---|
--corpus | Path to corpus directory (required) | |
--output | -o | Output directory for reports (default: reports) |
--regions | -r | Region codes to enable (default: cz) |
--iou-threshold | IoU threshold for span matching (default: 0.5) | |
--fail-on-regression | Exit with error code on regression | |
--baseline | Path to previous baseline JSON for regression detection |