ductus.core¶
The core: stream segments, or take the whole report. Everything else is a surface.
Two entry points, and the second is a facade over the first:
iter_segments() yields one Segment at a time as it
scores them – the streaming surface, for long documents and for a UI that wants
to paint as results arrive.
gauge() collects them into a Report.
The three seams are keyword arguments, each defaulting to something that
genuinely works rather than to a stub. The aggregate= default normalises evidence
by how much text produced it; the length-blind ductus.score.aggregate() is still
there, and misc/docs/phase-2-results.md has the measurement that chose between
them – on human-written text the length-blind scorer’s false-accusation rate ran from
11% to 74% with document length alone.
seam |
v1 default |
swap in |
|---|---|---|
|
|
|
|
all four deterministic detectors |
a model-based detector |
|
extra_signals= is not a seam but an input: evidence produced elsewhere –
by an agent reading the text, by a vendor API – attached to the segment that
contains it. It is how the shipped skills feed a model’s reading back in.
>>> report = gauge("Great question! Let's delve into this robust tapestry.")
>>> report.document.label
'leans-machine'
>>> report = gauge("Sent the export Friday. Two sites, not five. Call if it breaks.")
>>> report.document.label
'no-evidence'
Functions
|
Score |
|
Yield one scored segment at a time. |
- ductus.core.gauge(text, *, segmenter='paragraph', detectors=None, aggregate=<function density_aggregate>, extra_signals=())[source]¶
Score
textand roll the segments up into a report.The document-level verdict is computed from the segment verdicts, by
ductus.score.roll_up(), not from the pooled signals. Pooling every signal in the document and scoring the heap is what made a long human document more likely to be accused for being long: with a ~3% per-segment false-flag rate, the chance that something fires grows with the segment count. What is asked instead is what fraction of the segments carry directional evidence and which way they point – length-normalised by construction.misc/docs/document-verdict-decision.mdhas the argument and what it cost.The segments themselves are untouched by this, and remain the better evidence: a flagged sentence says much more than a flagged document.
>>> r = gauge("It is important to note that this is a robust tapestry.") >>> r.document.lean > 0 and r.n_chars == 55 True >>> r.segmenter, len(r.detectors) ('paragraph', 4)- Return type: