Detectors
Phone Number
Detect Czech mobile and landline numbers with context gating and operator or area metadata.
Purpose
Use the phone detector for Czech phone numbers.
This detector reports accuracy above 95% and distinguishes mobile from landline numbers.
It is intentionally conservative for local numbers without +420, because it requires nearby phone-related context before accepting them.
Detector Name
phoneSupported Formats
- Mobile:
+420 60x xxx xxx - Mobile:
+420 7xx xxx xxx - Landline:
+420 2xxxxxxxxthrough+420 5xxxxxxxx - Local forms without
+420can also match when context is present
Examples:
+420 602 123 456Mobile: 777 123 456Office: +420 2 1234 5678
Validation Logic
This detector uses both pattern checks and context checks.
Detection Rules
- Match either the mobile or landline pattern.
- Reject matches embedded inside larger digit sequences.
- Reject matches that sit inside a bank-account pattern.
- If the raw match starts with
+420, accept it directly. - If it does not start with
+420, require a phone-related keyword within 50 characters before the number.
Validation Rules
- FastPII normalizes spaces, dashes, and a leading
+. - If the value starts with
420, that prefix is stripped for validation. - Mobile values must be 9 digits and start with
6or7. - Landline values must be 9 digits and start with
2,3,4, or5.
There is no checksum algorithm for this detector.
Python Examples
Detect a mobile number
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["cz"])
result = guard.detect("Mobile: +420 602 123 456", detector_names=["phone"])
for finding in result.findings:
print(finding.value, finding.metadata)Validate a number directly
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["cz"])
result = guard.validate("+420 602 123 456", "phone")
print(result.is_valid)
print(result.metadata)Expected Metadata
This detector returns:
phone_type:mobileorlandlineoperator: for mobile numbers, such asO2,T-Mobile, orVodafonearea: for landline numbers, such asPraha
Example Output
{
"phone_type": "mobile",
"operator": "O2",
}Limitations
- Local numbers without
+420are ignored unless context appears before the match. - Operator mapping is prefix-based and may return
other. - Landline metadata uses broad regional groupings, not exact subscriber location.
Notes
Verified detection example from the codebase:
guard.detect("Mobile: +420 602 123 456")