Shows the redacted text together with each detected identifier (value masked), its confidence and the reasons it was detected - so you can check exactly what would leave the machine before sending anything.
Arguments
- text
A character vector.
- detectors
Detector ids to run;
NULLruns all registered detectors (seecg_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 calledvoter_idsupports Voter ID matches.- min_confidence
Drop matches scoring below this value.
Value
An object of class cg_preview: a list with text (the input),
redacted (as from redact()) and spans (as from detect_pii()).
Printing shows the redacted text and a masked table of the spans.
Examples
preview("Name: Priya Nair; PAN: ABCPN1234K; order no 878245671885")
#> 3 items would be redacted:
#> Name: [PERSON_NAME]; PAN: [PAN]; order no [AADHAAR]
#>
#> placeholder value confidence
#> [PERSON_NAME] XXXXX XXXX 0.80
#> [PAN] XXXXXX234K 0.97
#> [AADHAAR] XXXXXXXX1885 0.42
#> reasons
#> matched Person name pattern
#> matched PAN pattern; context 'PAN'; holder type: individual
#> matched Aadhaar number pattern; Verhoeff checksum valid; negative context 'order'