pub struct Redactor<'a> { /* private fields */ }Expand description
The pass’s state across one document: the pseudonym numbering and the
report. DoclingDocument::redact drives it over a whole document; the
streaming converter drives it over each page batch so the Markdown it
emits matches the buffered export byte for byte.
Implementations§
Source§impl<'a> Redactor<'a>
impl<'a> Redactor<'a>
pub fn new(opts: &'a RedactionOptions, detector: &'a dyn PiiDetector) -> Self
Sourcepub fn report(&self) -> &RedactionReport
pub fn report(&self) -> &RedactionReport
The report so far (the final one after the last batch).
pub fn finish(self) -> RedactionReport
Sourcepub fn has_pii(&self, text: &str) -> bool
pub fn has_pii(&self, text: &str) -> bool
Whether text carries any span the options keep — what the image
box-out asks per OCR line.
Sourcepub fn redact_text(&mut self, text: &mut String)
pub fn redact_text(&mut self, text: &mut String)
Redact one string in place.
Sourcepub fn redact_runs(&mut self, runs: &mut [InlineRun])
pub fn redact_runs(&mut self, runs: &mut [InlineRun])
Redact a run sequence as one text: spans are found on the joined runs and written back — the run the span starts in gets the placeholder, the runs it crosses lose the covered characters.
Sourcepub fn redact_nodes(&mut self, nodes: &mut [Node])
pub fn redact_nodes(&mut self, nodes: &mut [Node])
Redact every string of nodes, recursively.
Sourcepub fn redact_tree(&mut self, tree: &mut ItemTree)
pub fn redact_tree(&mut self, tree: &mut ItemTree)
Redact the item tree (#621: the JSON export reads it, not the nodes, for the backends that build one). The same pseudonym numbering as the nodes got; the counts are not incremented again — the tree is the same text in docling’s shape, not more of it.
Sourcepub fn redact_links(&mut self, links: &mut [(String, String)])
pub fn redact_links(&mut self, links: &mut [(String, String)])
Redact the link table ((text, href) pairs).
Sourcepub fn redact_document(&mut self, doc: &mut DoclingDocument)
pub fn redact_document(&mut self, doc: &mut DoclingDocument)
The whole document: nodes, tree, links, page renders.
Sourcepub fn redact_metadata(&mut self, m: &mut DocumentMetadata)
pub fn redact_metadata(&mut self, m: &mut DocumentMetadata)
The document’s metadata (#679). The author fields — authors,
last_modified_by, EXIF’s Artist / XPAuthor, an audio file’s
artist / album_artist / composer / performer — are names by
definition, so each is masked whole as a PERSON without asking a
detector (an allow term still exempts it); the GPS position and the
GPS* EXIF tags are dropped, counted as LOCATION; every other
string goes through the detectors like a paragraph (an e-mail in a
description, a phone number in a comment). The kinds filter applies:
kinds=email leaves the names and the position alone.