Skip to main content

De-identify Text

Send text to Guardian Layer, get a safer version back. Use fictional data to try it.

from custodian_labs import GuardianLayer

out = GuardianLayer().deidentify_text_outputs(
"Contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
masking_type="transform",
)
print(out.outputs[0].text)

transform or redact​

masking_typeOutput
transform (default)Readable stand-in values
redact*****

Limit which entities​

GuardianLayer().deidentify_text_outputs(text, pii_entities=["PERSON", "EMAIL_ADDRESS"])

Omit or ["ALL"] processes everything. See Supported Entities.

out.outputs holds one or two candidates; use outputs[0] by default.

See also​

Transform · Masking · Guardian Layer client