Skip to content

ProcessResult

ProcessResult

ProcessResult(
    lm_text: str,
    stat_text: str | None,
    language: str | None,
    metadata: ProcessMetadata | None = None,
)

Result of TextCleaner.process() / process_batch().

Behaves as a 3-tuple (lm_text, stat_text, language) for backward compatibility, but carries an optional .metadata dict for extended features.

Always present (from TextCleaner; value-free): source_chars — len of the input text regex_counts — {TYPE: {"count": int, "chars": int}} per regex replacement entity_counts — same shape, per NER entity type, concealed entities only language_confidence, language_source, warnings, provenance

.signals is the legacy value-free public view (see :mod:sct.signals). Unified mode uses findings_v2, counts_v2 and provenance_v2 instead. Its legacy count dictionaries stay empty; do not infer absence of PII from them. counts_v2 counts detector hits after configured allow-term filtering and resolved replacements, with version=2. Unified positions describe the canonical stage; source_ranges refer to the original input. include_entities=True adds sensitive findings_v2_values indexed into findings_v2. Those values include redacted spans and must be handled as sensitive audit data.

Metadata keys present only while their feature is active (absent otherwise): anon_map — :class:AnonymizationMap when replacement_mode='reversible' anon_map_reference — opaque external token-store reference classes — list[dict] when check_classify_document=True findings — policy decisions and detected entity spans, with include_entities=True or a privacy policy policy — active policy name and version

lm_text instance-attribute

lm_text = lm_text

stat_text instance-attribute

stat_text = stat_text

language instance-attribute

language = language

metadata instance-attribute

metadata = {} if metadata is None else metadata

signals property

signals: Signals

Value-free view: counts, shares, types, language, models; never entity text.