Skip to main content

PII detection and anonymization using HuggingFace NER models

Project description

privacy-kit

PII detection and anonymization for multilingual text, powered by bardsai/eu-pii-anonimization-multilang.

Installation

pip install privacy-kit

Or install directly from GitHub:

pip install git+https://github.com/bards-ai/privacy-kit.git

For development:

git clone https://github.com/bards-ai/privacy-kit.git
cd privacy-kit
uv venv && uv pip install -e .

Quick start

from privacy_kit import PiiModel

model = PiiModel()

text = "Anna Wiśniewska mieszka na ul. Piękna 22, 00-549 Warszawa."

# Simple anonymization
model.anonymize(text)
# → '[PERSON_NAME] mieszka na [LOCATION].'

# Anonymization with entity IDs
model.anonymize(text, mode="ids")
# → {'anonymized_text': '[PERSON_NAME:1] mieszka na [LOCATION:1].',
#    'entities': {'PERSON_NAME:1': 'Anna Wiśniewska',
#                 'LOCATION:1': 'ul. Piękna 22, 00-549 Warszawa'}}

# Extract PII entities
model.extract_pii(text)
# → {'Anna Wiśniewska': 'PERSON_NAME',
#    'ul. Piękna 22, 00-549 Warszawa': 'LOCATION'}

Supported entity types

The underlying model recognizes EU-relevant PII categories including: PERSON_NAME, LOCATION, FINANCIAL_AMOUNT, PERSON_IDENTIFIER, ORGANIZATION_IDENTIFIER, PROPER_NAME, RELIGION_OR_BELIEF, TRADE_UNION_MEMBERSHIP, and more.

License

Apache-2.0

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

privacy_kit-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

privacy_kit-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file privacy_kit-0.1.0.tar.gz.

File metadata

  • Download URL: privacy_kit-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for privacy_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15cbae79ecaa21ebf8053e67b484b40e60dcb1bd0271ffbc0c6f88949054c21e
MD5 22c736a65163f87152fb3a364392b240
BLAKE2b-256 af43e7ad8e670b058e5b9f5f30cc9cc198f480225957972e1b31efb7acf07be8

See more details on using hashes here.

File details

Details for the file privacy_kit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for privacy_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69ea4e0145930c492b7857197fc38fa6a71d61f288e9ae339348a58188732fd7
MD5 dbc914b291a470afffccdf88a2d624e4
BLAKE2b-256 4f95a9c8ce8734d4f6833fbee813dc5b506a3955a18c0e4b111b34aacd5dffcd

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