pub struct DedupChecker { /* private fields */ }Expand description
Checks for duplicate and similar replies.
Implementations§
Source§impl DedupChecker
impl DedupChecker
Sourcepub async fn has_replied_to(&self, tweet_id: &str) -> Result<bool, StorageError>
pub async fn has_replied_to(&self, tweet_id: &str) -> Result<bool, StorageError>
Check if a reply has already been sent to the given tweet.
Returns true if a reply exists in replies_sent for this tweet ID.
Sourcepub async fn is_phrasing_similar(
&self,
new_reply: &str,
limit: i64,
) -> Result<bool, StorageError>
pub async fn is_phrasing_similar( &self, new_reply: &str, limit: i64, ) -> Result<bool, StorageError>
Check if a proposed reply is too similar to recent replies.
Compares against the last limit replies using Jaccard word similarity.
Returns true if any recent reply has >= 0.8 similarity or is an exact match.
Replies shorter than 5 words skip the similarity check (too short for meaningful comparison).
Sourcepub async fn get_recent_reply_phrases(
&self,
limit: i64,
) -> Result<Vec<String>, StorageError>
pub async fn get_recent_reply_phrases( &self, limit: i64, ) -> Result<Vec<String>, StorageError>
Get recent reply contents for testing and debugging.
Auto Trait Implementations§
impl Freeze for DedupChecker
impl !RefUnwindSafe for DedupChecker
impl Send for DedupChecker
impl Sync for DedupChecker
impl Unpin for DedupChecker
impl UnsafeUnpin for DedupChecker
impl !UnwindSafe for DedupChecker
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