An implementation to mask PII in Natural Language Text.
pip install -U https://github.com/Sripaad/ai4privacy.git
from ai4p.AI4P import Anonymizer
import torch
def set_seed(seed):
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
set_seed(864)
anonymizer = Anonymizer(use_gpu=False)
input_sentence = "My name is Clara and I live in Berkeley, California."
pii_masked_sentence = anonymizer.pii_mask(input_sentence)
print("-" *100)
print("[INPUT]: ", input_sentence)
print("[PII_MASKED]: ", pii_masked_sentence)
print("-" *100)
------------------------------------------------------------------------------------------------------------------------
[INPUT]: "My name is Clara and I live in Berkeley, California."
[PII_MASKED]: "My name is [FIRSTNAME] and I live in [CITY], [STATE]."
------------------------------------------------------------------------------------------------------------------------
- Isotonic/distilbert_finetuned_ai4privacy
- Isotonic/t5-base-ai4privacy
- Isotonic/t5-small-ai4privacy
- Isotonic/mt5-small-ai4privacy