pub struct PatternMatcher { /* private fields */ }Expand description
Advanced pattern matcher for type names with fuzzy matching capabilities
Implementations§
Source§impl PatternMatcher
impl PatternMatcher
Sourcepub fn add_pattern(
&mut self,
id: &str,
pattern: &str,
weight: f64,
description: &str,
) -> Result<(), PatternMatcherError>
pub fn add_pattern( &mut self, id: &str, pattern: &str, weight: f64, description: &str, ) -> Result<(), PatternMatcherError>
Add a pattern to the matcher
Add a pattern with tags
Sourcepub fn find_matches(&self, input: &str) -> Vec<PatternMatch>
pub fn find_matches(&self, input: &str) -> Vec<PatternMatch>
Find all matches for a given input
Sourcepub fn find_best_match(&self, input: &str) -> Option<PatternMatch>
pub fn find_best_match(&self, input: &str) -> Option<PatternMatch>
Find the best match for a given input
Sourcepub fn find_matches_by_tag(&self, input: &str, tag: &str) -> Vec<PatternMatch>
pub fn find_matches_by_tag(&self, input: &str, tag: &str) -> Vec<PatternMatch>
Find matches by tags
Sourcepub fn set_fuzzy_threshold(&mut self, threshold: f64)
pub fn set_fuzzy_threshold(&mut self, threshold: f64)
Set fuzzy matching threshold
Sourcepub fn get_fuzzy_threshold(&self) -> f64
pub fn get_fuzzy_threshold(&self) -> f64
Get fuzzy matching threshold
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear the match cache
Sourcepub fn get_stats(&self) -> PatternMatcherStats
pub fn get_stats(&self) -> PatternMatcherStats
Get pattern statistics
Sourcepub fn get_pattern_ids(&self) -> Vec<String>
pub fn get_pattern_ids(&self) -> Vec<String>
Get all pattern IDs
Sourcepub fn get_pattern(&self, id: &str) -> Option<&CompiledPattern>
pub fn get_pattern(&self, id: &str) -> Option<&CompiledPattern>
Get pattern by ID
Sourcepub fn remove_pattern(&mut self, id: &str) -> bool
pub fn remove_pattern(&mut self, id: &str) -> bool
Remove pattern by ID
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PatternMatcher
impl RefUnwindSafe for PatternMatcher
impl Send for PatternMatcher
impl Sync for PatternMatcher
impl Unpin for PatternMatcher
impl UnwindSafe for PatternMatcher
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