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
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15cbae79ecaa21ebf8053e67b484b40e60dcb1bd0271ffbc0c6f88949054c21e
|
|
| MD5 |
22c736a65163f87152fb3a364392b240
|
|
| BLAKE2b-256 |
af43e7ad8e670b058e5b9f5f30cc9cc198f480225957972e1b31efb7acf07be8
|
File details
Details for the file privacy_kit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: privacy_kit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69ea4e0145930c492b7857197fc38fa6a71d61f288e9ae339348a58188732fd7
|
|
| MD5 |
dbc914b291a470afffccdf88a2d624e4
|
|
| BLAKE2b-256 |
4f95a9c8ce8734d4f6833fbee813dc5b506a3955a18c0e4b111b34aacd5dffcd
|