Skip to contents

Replaces every detected identifier with a placeholder naming its type, for example [PAN] or [PERSON_NAME]. Everything else in the text is kept exactly. Redaction is irreversible; the rules are shared with the Python package (see the spec's "Redaction" section).

Usage

redact(text, detectors = NULL, context = NULL, min_confidence = 0)

Arguments

text

A character vector.

detectors

Detector ids to run; NULL runs all registered detectors (see cg_detectors()).

context

Optional extra context per element of text (recycled), treated as if it appeared next to every match. scan_pii() (planned) passes column names here, so a column called voter_id supports Voter ID matches.

min_confidence

Drop matches scoring below this value.

Value

A character vector the same length as text, with PII replaced. NA stays NA.

See also

preview() to see what would be redacted and why.

Examples

redact("Name: Priya Nair; PAN: ABCPN1234K")
#> [1] "Name: [PERSON_NAME]; PAN: [PAN]"
redact(c("UPI priya.n@oksbi", "nothing here"))
#> [1] "UPI [UPI_ID]" "nothing here"