"""Check the install: find and redact PII in four sample texts. python example.py """ from pii import PIIExtractor SAMPLES = [ "Hi team, I'm Priya Raman (priya.raman@northwind.com). Please call me on +1-860-555-0185 ext 204 " "before Friday's review of ticket INC-48213.", "Shipping address for order PO-552310: Marcus Bell, 742 Evergreen Terrace, Springfield, IL 62704. " "Card ending 4417, customer no. CU-0098213, date of birth 1987-03-14. Our Denver office will follow up.", "User: my login is mbell_92 and the temporary password is K7#pQ2!xZ. The portal is " "portal.northwind.io/reset and my server IP is 10.24.8.117. Employee ID EMP-20931, SSN 512-44-9087.", "<@U02NORA> can you send dan the verification code 357-761-475? Patient MRN 00482917 is booked for Tuesday.", ] pii = PIIExtractor() print(f"model loaded on {pii.device}\n") for text in SAMPLES: spans, ms = pii.timed_extract(text) print(text) for s in spans: print(f" {s['label']:15} {s['text']!r} [{s['start']}:{s['end']}]") print(f" redacted: {pii.redact(text)}") print(f" ({ms:.0f} ms)\n")