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.2.tar.gz (7.6 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.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pii_masker-0.1.2.tar.gz
  • Upload date:
  • Size: 7.6 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.2.tar.gz
Algorithm Hash digest
SHA256 02cb17c8df27a30342417e0315b07858b7a749378e48cca51bcf54e7ca23d97f
MD5 0cbf2e74a503175783ebfa13e3ed4cde
BLAKE2b-256 eac8b17cf56b1596eed42b87348c1a37cf0ad63926662d7029ff86f66b7440aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pii_masker-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92d10e856a7a1b54620a827c90262689953032a168668fc0b74c0ca549170f7c
MD5 431d6a039a4ce866881358329c951a04
BLAKE2b-256 8697e5871053da897563a7a881e62adce9c104ca33c979f6cb8d3c6a6c7cc19b

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