pub struct DeltaScorer { /* private fields */ }Expand description
Answer-impact scorer: scores a chunk by whether including it would change a downstream answer, relative to the evidence already selected.
The “would the answer change?” judgement is an injectable closure
(impact_fn) so the engine core never embeds a model. The closure
receives the same EvidenceContext the trait does and returns a
score in [0, 1]. A typical production wiring calls an LLM:
“given the answer derivable from selected, does adding
candidate change it? rate 0–1”.
DeltaScorer::stub ships a deterministic marginal-novelty
heuristic (high when the candidate’s token set is novel vs what is
already selected, low when redundant) so tests and offline runs
have a model-free default that still exhibits diminishing returns.
Implementations§
Source§impl DeltaScorer
impl DeltaScorer
Sourcepub fn new<F>(impact_fn: F) -> Self
pub fn new<F>(impact_fn: F) -> Self
Build a scorer from a caller-supplied answer-impact closure.
Sourcepub fn stub() -> Self
pub fn stub() -> Self
Model-free stub: marginal-novelty heuristic. The candidate’s score is the fraction of its whitespace tokens that do NOT already appear in any selected candidate, scaled by its retrieval score. A fresh chunk scores near its retrieval score; a fully-redundant chunk scores ~0 — so the budget exhibits the diminishing-returns shape an answer-impact signal should.
Sourcepub fn impact(&self, ctx: &EvidenceContext<'_>) -> f32
pub fn impact(&self, ctx: &EvidenceContext<'_>) -> f32
Score via the injected closure.
Trait Implementations§
Source§impl EvidenceScorer for DeltaScorer
impl EvidenceScorer for DeltaScorer
Auto Trait Implementations§
impl !RefUnwindSafe for DeltaScorer
impl !UnwindSafe for DeltaScorer
impl Freeze for DeltaScorer
impl Send for DeltaScorer
impl Sync for DeltaScorer
impl Unpin for DeltaScorer
impl UnsafeUnpin for DeltaScorer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more