pub struct TemporalWindowMatcher {
pub window_size: usize,
pub stride: usize,
}Expand description
Compares two sequences of SegmentFingerprints using a sliding temporal window.
The matcher slides a window of window_size fingerprints across both
sequences (with stride step), computing the average per-hash Hamming
similarity for each aligned window pair.
Fields§
§window_size: usizeNumber of segments per window.
stride: usizeStep between consecutive windows.
Implementations§
Source§impl TemporalWindowMatcher
impl TemporalWindowMatcher
Sourcepub fn new(window_size: usize, stride: usize) -> Self
pub fn new(window_size: usize, stride: usize) -> Self
Create a new matcher with explicit window/stride.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a matcher with sensible defaults (window=4, stride=2).
Sourcepub fn compare_sequences(
&self,
a: &[SegmentFingerprint],
b: &[SegmentFingerprint],
) -> f32
pub fn compare_sequences( &self, a: &[SegmentFingerprint], b: &[SegmentFingerprint], ) -> f32
Compare two sequences by finding the highest-scoring window alignment.
Extracts windows from a and b and tries all combinations, returning
the maximum similarity found across all window pairs.
Returns 0.0 if either sequence is shorter than window_size.
Sourcepub fn find_best_alignment(
&self,
a: &[SegmentFingerprint],
b: &[SegmentFingerprint],
) -> Option<(usize, usize, f32)>
pub fn find_best_alignment( &self, a: &[SegmentFingerprint], b: &[SegmentFingerprint], ) -> Option<(usize, usize, f32)>
Find the best-aligned window pair between two sequences.
Returns Some((offset_a, offset_b, similarity)) for the best match,
or None if either sequence is too short.
Trait Implementations§
Source§impl Clone for TemporalWindowMatcher
impl Clone for TemporalWindowMatcher
Source§fn clone(&self) -> TemporalWindowMatcher
fn clone(&self) -> TemporalWindowMatcher
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TemporalWindowMatcher
impl RefUnwindSafe for TemporalWindowMatcher
impl Send for TemporalWindowMatcher
impl Sync for TemporalWindowMatcher
impl Unpin for TemporalWindowMatcher
impl UnsafeUnpin for TemporalWindowMatcher
impl UnwindSafe for TemporalWindowMatcher
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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