pub struct NameMatcher {
pub threshold: f64,
pub first_name_weight: f64,
pub last_name_weight: f64,
}Expand description
Name matcher with Brazilian conventions
Fields§
§threshold: f64Minimum similarity threshold for a match
first_name_weight: f64Weight for first name matching
last_name_weight: f64Weight for last name matching
Implementations§
Source§impl NameMatcher
impl NameMatcher
Sourcepub fn with_threshold(self, threshold: f64) -> Self
pub fn with_threshold(self, threshold: f64) -> Self
Set minimum similarity threshold
Sourcepub fn normalize(&self, name: &str) -> String
pub fn normalize(&self, name: &str) -> String
Normalize a name for comparison
- Converts to lowercase
- Removes accents
- Removes prepositions
- Normalizes whitespace
Sourcepub fn extract_parts(&self, name: &str) -> NameParts
pub fn extract_parts(&self, name: &str) -> NameParts
Extract name parts (first name, middle names, last name)
Sourcepub fn similarity(&self, name1: &str, name2: &str) -> f64
pub fn similarity(&self, name1: &str, name2: &str) -> f64
Calculate similarity between two names
Returns a score between 0.0 and 1.0
Sourcepub fn matches(&self, name1: &str, name2: &str) -> bool
pub fn matches(&self, name1: &str, name2: &str) -> bool
Check if two names match above threshold
Sourcepub fn to_entity_id(&self, name: &str) -> String
pub fn to_entity_id(&self, name: &str) -> String
Generate a normalized entity ID from a name
Trait Implementations§
Source§impl Clone for NameMatcher
impl Clone for NameMatcher
Source§fn clone(&self) -> NameMatcher
fn clone(&self) -> NameMatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NameMatcher
impl Debug for NameMatcher
Auto Trait Implementations§
impl Freeze for NameMatcher
impl RefUnwindSafe for NameMatcher
impl Send for NameMatcher
impl Sync for NameMatcher
impl Unpin for NameMatcher
impl UnsafeUnpin for NameMatcher
impl UnwindSafe for NameMatcher
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