π₯Έ tanaos-text-anonymizer-v1: A small but performant Text Anonymization model
This model was created by Tanaos with the Artifex Python library.
This is a multilingual (it supports 16+ languages) Named Entity Recognition model based on tanaos/tanaos-NER-v1 and fine-tuned on a synthetic dataset to recognize Personal Identifiable Information (PII) entities in text. Once identified, the entities can be redacted to ensure privacy and confidentiality, before sharing or processing text data.
While the base NER model was trained to recognize 14 named entity categories, this Text Anonymization was fine-tuned specifically to focus on the following 5 key PII entity categories that are commonly found in text data and are critical for anonymization:
| Entity | Description |
|---|---|
PERSON |
Individual people, fictional characters |
LOCATION |
Geographical areas |
DATE |
Absolute or relative dates, including years, months and/or days |
ADDRESS |
Full addresses |
PHONE_NUMBER |
Telephone numbers |
βοΈ How to Use
This model can be used in one of two ways:
Via the Artifex library (pip install artifex)
Using this model through our Artifex Python library, Personal Identifiable Information (PII) aren't just detected, but automatically redacted from the text, replacing them with a placeholder.
from artifex import Artifex
ta = Artifex().text_anonymization
print(ta("John Doe lives at 123 Main St, New York. His phone number is (555) 123-4567."))
# >>> ["[MASKED] lives at [MASKED]. His phone number is [MASKED]."]
Via the Transformers library
Using this model through the transformers library, Personal Identifiable Information (PII) are only identified, but not automatically redacted; you will have to implement your own redaction logic.
from transformers import pipeline
ta = pipeline(
task="token-classification",
model="tanaos/tanaos-text-anonymizer-v1",
aggregation_strategy="first"
)
print(ta("John Doe lives at 123 Main St, New York. His phone number is (555) 123-4567."))
# >>> [{'entity_group': 'PERSON', 'score': 0.90219176, 'word': 'John Doe', 'start': 0, 'end': 8}, {'entity_group': 'ADDRESS', 'score': 0.9522348, 'word': ' 123 Main St,', 'start': 18, 'end': 30}, {'entity_group': 'LOCATION', 'score': 0.97109795, 'word': ' New York.', 'start': 31, 'end': 40}, {'entity_group': 'PHONE_NUMBER', 'score': 0.9054972, 'word': ' (555) 123-4567.', 'start': 61, 'end': 76}]
π§ Model Description
- Base model:
FacebookAI/roberta-base - Task: Token classification (Named Entity Recognition for Text Anonymization)
- Languages: Multilingual (16+ languages)
- Fine-tuning data: A synthetic, custom dataset of around 10,000 passages, each containing multiple named entities across 5 Personal Identifiable Information categories.
π Training Details
This model was trained using the Artifex Python library
pip install artifex
by providing the following instructions and generating 10,000 synthetic training samples:
from artifex import Artifex
ta = Artifex().text_anonymization
ta.train(
domain="general",
num_samples=10000
)
π§° Intended Uses
This model is intended to:
- Anonymize text data by redacting personal identifiable information (PII) such as names, addresses, phone numbers, dates, and locations.
- Ensure privacy and confidentiality in text data for compliance with data protection regulations.
- Be used before sharing or processing text data to protect sensitive information.
- Be GDPR compliant when handling personal data.
Not intended for:
- Scenarios involving highly specialized or domain-specific text without further fine-tuning.
- Downloads last month
- 21