Skip to main content

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


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.1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pii_masker-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file pii_masker-0.1.1.tar.gz.

File metadata

  • Download URL: pii_masker-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for pii_masker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 161982a8147e395c663df1c25782bcfe0d928ada030420c770d944831ff6c163
MD5 0c103ce04cb40efd026d17327abbf86f
BLAKE2b-256 8b7b777cf0e94f1d91c04dc5185a918027aa659a10d51c6c60d29205dc5313bd

See more details on using hashes here.

File details

Details for the file pii_masker-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pii_masker-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for pii_masker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1628b979cd69e8c07ebc8b90058b6f5228e84a07994245c18dbf7a692adc54a7
MD5 8798ffd81661076ec2172c06096198e7
BLAKE2b-256 2bd76616cfbca649ed1d478a317ee3c143974a2dacd7a3356717ca9b835e032b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page