Skip to main content

SchemeActionScorer

Struct SchemeActionScorer 

Source
pub struct SchemeActionScorer<K, S> { /* private fields */ }
Expand description

An [ActionScorer] that boosts scores for scheme-backed actions.

Wraps an inner scorer and, for each scored affordance, looks up argument positions from ArgumentKnowledge. If any position maps to a registered scheme, the affordance score is increased by:

max_boost * strength_multiplier * preference_weight

The highest boost across all positions wins. The returned list is sorted descending by final score.

Implementations§

Source§

impl<K: ArgumentKnowledge, S> SchemeActionScorer<K, S>

Source

pub fn new( knowledge: K, registry: CatalogRegistry, inner: S, max_boost: f64, ) -> Self

Create a new SchemeActionScorer.

§Parameters
  • knowledge – provides per-character argument positions.
  • registry – the scheme catalog used to resolve scheme strengths.
  • inner – the base scorer whose results are boosted.
  • max_boost – the maximum additive score increase for a Strong scheme with preference_weight = 1.0.

Trait Implementations§

Source§

impl<K, S, P> ActionScorer<P> for SchemeActionScorer<K, S>
where K: ArgumentKnowledge, S: ActionScorer<P>, P: Clone,

Source§

fn score_actions( &self, actor: &str, available: &[CatalogEntry<P>], participants: &[String], ) -> Vec<ScoredAffordance<P>>

Score available actions, boosting those with scheme backing.

Delegates to the inner scorer, then for each result looks up argument positions from the knowledge base and applies the best scheme boost. Returns results sorted descending by final score.

Auto Trait Implementations§

§

impl<K, S> Freeze for SchemeActionScorer<K, S>
where K: Freeze, S: Freeze,

§

impl<K, S> RefUnwindSafe for SchemeActionScorer<K, S>

§

impl<K, S> Send for SchemeActionScorer<K, S>
where K: Send, S: Send,

§

impl<K, S> Sync for SchemeActionScorer<K, S>
where K: Sync, S: Sync,

§

impl<K, S> Unpin for SchemeActionScorer<K, S>
where K: Unpin, S: Unpin,

§

impl<K, S> UnsafeUnpin for SchemeActionScorer<K, S>
where K: UnsafeUnpin, S: UnsafeUnpin,

§

impl<K, S> UnwindSafe for SchemeActionScorer<K, S>
where K: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.