FastPII Docs
Reference

CLI Reference

Command-line interface reference for all FastPII commands.

CLI Reference

Installation

The CLI is included with the fastpii package:

pip install fastpii

Global options

fastpii --help

Commands

detect

Detect PII in text or a file.

fastpii detect "text to analyze" [OPTIONS]

Positional arguments

ArgumentDescription
textText to analyze (optional if --file is used)

Options

OptionShortTypeDefaultDescription
--file-fPathRead text from file
--regions-rlist[str]RequiredRegion codes to enable (e.g., cz pl de fr)
--format-fmtjson or texttextOutput format
--output-oPathWrite 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 fr

JSON 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

ArgumentDescription
valueValue to validate

Options

OptionShortTypeDefaultDescription
--detector-dstrRequiredDetector name to use
--regions-rlist[str]RequiredRegion codes to enable
--format-fmtjson or texttextOutput 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 json

Text output format

Validation Result:
  Detector: rodne_cislo
  Value: 8001011238
  Status: ✓ VALID
  Metadata:
    - checksum_valid: True
    - birth_date: 1980-01-01
    - gender: male

list-detectors

List available detectors for given regions.

fastpii list-detectors [OPTIONS]

Options

OptionShortTypeDefaultDescription
--regions-rlist[str]RequiredRegion codes to enable
--format-fmtjson or texttextOutput 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 json

evaluate

Evaluate detectors against a benchmark corpus.

fastpii evaluate --corpus PATH [OPTIONS]

Options

OptionShortTypeDefaultDescription
--corpusPathRequiredPath to corpus directory
--output-oPathreportsOutput directory for reports
--regions-rlist[str]["cz"]Region codes to enable
--iou-thresholdfloat0.5IoU threshold for span matching
--fail-on-regressionflagFalseExit with error code on regression
--baselinePathPath 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 cz

Output

============================================================
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

On this page