Documentation
¶
Overview ¶
Package engine runs the classification cascade: records flow from a Source through an ordered list of Stages into a Sink. Each record exits at the first stage that can decide it, so cheap stages shield expensive ones. Records no stage can classify are routed to an optional review sink.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
// Source yields the records to classify. Required.
Source source.Source
// Stages is the cascade, cheapest first. At least one is required.
Stages []stage.Stage
// Sink receives every classified record. Required.
Sink sink.Sink
// Review receives records no stage could classify, with a zero
// Classification. Optional; when nil such records are dropped.
Review sink.Sink
// Logger defaults to slog.Default.
Logger *slog.Logger
// MinConfidence is the gate: a stage's classification below this
// threshold is treated as undecided and the record escalates to the
// next stage. Zero disables gating. Deterministic stages emit 1, so
// they always pass.
MinConfidence float64
// Workers is how many goroutines classify at once. Zero or one keeps
// the serial loop. More requires stages safe for concurrent Classify,
// and the engine closes the Source when a failure ends the run early.
// Order, errors, and Stats match the serial loop exactly.
Workers int
}
Deps bundles everything an Engine needs.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine drives records through the cascade.
type Stats ¶
type Stats struct {
// Processed counts records read from the source.
Processed int
// Classified counts records some stage decided.
Classified int
// Reviewed counts records no stage decided, whether routed to the
// review sink or dropped.
Reviewed int
// ByStage counts classifications per stage name.
ByStage map[string]int
}
Stats summarizes one Run.
Click to show internal directories.
Click to hide internal directories.