Span#
- class scikitplot.cleanprompt.Span(start, end, kind, text, detector, priority=0, confidence=1.0)[source]#
A half-open
[start, end)character interval flagged by one detector.- Parameters:
- startint
Inclusive start offset into the original text. Must be
>= 0.- endint
Exclusive end offset. Must be
> start.- kindstr
Category label used to build the placeholder, for example
"EMAIL". Must be non-empty and contain no placeholder delimiter characters.- textstr
The matched surface, exactly as it appears in the original.
- detectorstr
Name of the detector that produced this span.
- priorityint, default=0
Arbitration weight. Higher wins under
PRIORITY_WINS.- confidencefloat, default=1.0
Detector-reported confidence in
[0.0, 1.0]. Carried for reporting and filtering; it never silently drops a span.
- Raises:
- ValueError
If the interval is empty or negative, if
kindis empty, or ifconfidenceis outside[0.0, 1.0].
- Parameters:
Notes
Developer notes. The field order gives a meaningful
order=True: spans sort by start, then by end. Resolution relies on that natural order and then applies its own tie-breaks, so sorting is stable and reproducible across processes regardless of hash randomisation.Examples
>>> Span(0, 5, "EMAIL", "a@b.c", "email").length 5