pub struct ScoringEngine { /* private fields */ }Expand description
Scoring engine that combines all signals into a unified score.
Implementations§
Source§impl ScoringEngine
impl ScoringEngine
Sourcepub fn new(config: ScoringConfig, keywords: Vec<String>) -> Self
pub fn new(config: ScoringConfig, keywords: Vec<String>) -> Self
Create a new scoring engine with the given config and keywords.
Keywords should be the combined list of product_keywords and
competitor_keywords from the business profile.
Sourcepub fn score_tweet(&self, tweet: &TweetData) -> TweetScore
pub fn score_tweet(&self, tweet: &TweetData) -> TweetScore
Score a tweet using all four signals.
Uses the current time for recency scoring.
Sourcepub fn score_tweet_at(
&self,
tweet: &TweetData,
now: DateTime<Utc>,
) -> TweetScore
pub fn score_tweet_at( &self, tweet: &TweetData, now: DateTime<Utc>, ) -> TweetScore
Score a tweet using all six signals with a specific time reference.
Accepts now for deterministic testing.
Sourcepub fn config(&self) -> &ScoringConfig
pub fn config(&self) -> &ScoringConfig
Return the scoring configuration.
Auto Trait Implementations§
impl Freeze for ScoringEngine
impl RefUnwindSafe for ScoringEngine
impl Send for ScoringEngine
impl Sync for ScoringEngine
impl Unpin for ScoringEngine
impl UnsafeUnpin for ScoringEngine
impl UnwindSafe for ScoringEngine
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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