A library for detecting and masking PII
Project description
PII Masker
A Python library for detecting and masking Personally Identifiable Information (PII) in text using spaCy and Microsoft Presidio.
Features
- Detect and mask various PII types: names, emails, phone numbers, SSNs, credit cards, etc.
- Context-aware detection using NLP
- Custom pattern recognizers
- Easy to use API
Installation
From PyPI (once published)
pip install pii-masker
From source
git clone https://github.com/yourusername/pii-masker.git
cd pii-masker
pip install -e .
### Download spaCy model
```bash
python -m spacy download en_core_web_lg
Quick Start
from pii_masker import mask_pii
text = "My name is John Doe and my SSN is 123-45-6789"
masked_text = mask_pii(text)
print(masked_text)
# Output: "My name is <NAME> and my SSN is <SSN>"
Advanced Usage
from pii_masker import CustomPIIMasker
masker = CustomPIIMasker()
# Mask PII
text = "Contact me at john@example.com or call 555-123-4567"
masked = masker.mask_pii(text)
# Get detected entities
entities = masker.get_detected_entities(text)
for entity in entities:
print(f"{entity['entity_type']}: {entity['text']}")
Supported PII Types
- Names (PERSON)
- Email addresses
- Phone numbers
- Social Security Numbers (SSN)
- Driver's License numbers
- Passport numbers
- Credit card numbers
- Bank account numbers
- Medical record numbers
- Usernames and passwords
- And more...
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pii_masker-0.1.0.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pii_masker-0.1.0.tar.gz.
File metadata
- Download URL: pii_masker-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eb5e8a063b4641420301b497ee8f4fd0a81a177c056c7bd18e02f58054e4943
|
|
| MD5 |
e8d2fc2ee741f902c708022600ace8c0
|
|
| BLAKE2b-256 |
746483dacf9a6e165f455e842d077cc48f2d25d6b500c890041272402b527f5b
|
File details
Details for the file pii_masker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pii_masker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95fef04e52a12a852a47eab82013278434a392609b00b0bf8cef6d7fa4f7ccbf
|
|
| MD5 |
9a455abfb1ce937ccd8e676e20cd4413
|
|
| BLAKE2b-256 |
f371a90f7f53e0e88b2019b40ac1f09d80ccc537ddaeb938398a69082a27c22e
|