symfonic.tools.corpus_scrub.jsonl_io¶
jsonl_io ¶
Streaming a JSONL corpus through :class:CorpusScrubber.
The file-level half of corpus scrub: open (optionally gzipped) input, scrub row
by row, write (optionally gzipped) output, and return the counts that become
the manifest sidecar. It is separated from
:mod:symfonic.tools.corpus_scrub.scrubber -- which owns the redaction engine
and the instance-scoped token mapping -- because nothing here knows a pattern
from a placeholder; it knows files, lines, and totals.
scrub_jsonl_file ¶
scrub_jsonl_file(*, input_path: Path, output_path: Path, scrubber: CorpusScrubber | None = None, drop_on_doubt: bool = True) -> dict[str, Any]
Stream a JSONL file through :class:CorpusScrubber.
Input may be plain .jsonl or gzipped .jsonl.gz. Output
extension determines compression (.gz -> gzip). Per architect
spec, the canonical output shape is .jsonl.gz so the file is
transferable without further compression.
Returns a summary dict
{
"input_rows": int,
"output_rows": int,
"dropped_rows": int,
"match_counts": dict[str, int],
}
The summary is also the natural shape for a manifest sidecar.