pub struct FilenameMatcher { /* private fields */ }Expand description
Normalized filename / title matcher for media deduplication.
Strips common media-file noise (resolution tags, codec names, release-group markers, punctuation) and computes a combined similarity from Levenshtein edit distance, token Jaccard, and bigram Dice coefficient.
Implementations§
Source§impl FilenameMatcher
impl FilenameMatcher
Sourcepub fn with_weights(
threshold: f64,
edit_w: f64,
token_w: f64,
bigram_w: f64,
) -> Self
pub fn with_weights( threshold: f64, edit_w: f64, token_w: f64, bigram_w: f64, ) -> Self
Create with custom weights. Weights are normalized internally.
Sourcepub fn normalize(name: &str) -> String
pub fn normalize(name: &str) -> String
Normalize a filename/title for comparison.
Strips extension, converts to lowercase, removes common noise tokens (resolution tags, codec names, quality markers), and collapses whitespace.
Sourcepub fn similarity(&self, name_a: &str, name_b: &str) -> FuzzyScore
pub fn similarity(&self, name_a: &str, name_b: &str) -> FuzzyScore
Compute the combined similarity score between two filenames/titles.
Sourcepub fn is_match(&self, name_a: &str, name_b: &str) -> bool
pub fn is_match(&self, name_a: &str, name_b: &str) -> bool
Returns true if the two filenames are considered matching.
Sourcepub fn find_matching_pairs(
&self,
names: &[&str],
) -> Vec<(usize, usize, FuzzyScore)>
pub fn find_matching_pairs( &self, names: &[&str], ) -> Vec<(usize, usize, FuzzyScore)>
Find all matching pairs within a list of filenames.
Returns Vec<(usize, usize, FuzzyScore)> with i < j.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FilenameMatcher
impl RefUnwindSafe for FilenameMatcher
impl Send for FilenameMatcher
impl Sync for FilenameMatcher
impl Unpin for FilenameMatcher
impl UnsafeUnpin for FilenameMatcher
impl UnwindSafe for FilenameMatcher
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> 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