pub struct SeqStrSim<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> {
pub tokenizer: &'t mut TK,
pub strsim: SS,
/* private fields */
}Fields§
§tokenizer: &'t mut TK§strsim: SSImplementations§
Source§impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> SeqStrSim<'t, T, SS, TK>
pub fn new(tokenizer: &'t mut TK, strsim: SS) -> Result<Self, StrSimError>
Trait Implementations§
Source§impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> StrSim<T> for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> StrSim<T> for SeqStrSim<'t, T, SS, TK>
Source§fn similarity_pre_tok2(
&self,
tokenized_key: &T,
tokenized_query: &T,
) -> Result<f64, StrSimError>
fn similarity_pre_tok2( &self, tokenized_key: &T, tokenized_query: &T, ) -> Result<f64, StrSimError>
Calculate the similarity with both key and query has already``` been pre-tokenized
Source§impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: MutTokenizer<T, Return = ByValue> + Display> StrSimWithMutTokenizer<T> for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: MutTokenizer<T, Return = ByValue> + Display> StrSimWithMutTokenizer<T> for SeqStrSim<'t, T, SS, TK>
Source§fn similarity(&mut self, key: &str, query: &str) -> Result<f64, StrSimError>
fn similarity(&mut self, key: &str, query: &str) -> Result<f64, StrSimError>
See StrSimWithTokenizer::similarity
Source§fn similarity_pre_tok1(
&mut self,
key: &str,
tokenized_query: &T,
) -> Result<f64, StrSimError>
fn similarity_pre_tok1( &mut self, key: &str, tokenized_query: &T, ) -> Result<f64, StrSimError>
See StrSimWithTokenizer::similarity_pre_tok1
Source§fn tokenize_list(&mut self, strs: &[&str]) -> Vec<T>
fn tokenize_list(&mut self, strs: &[&str]) -> Vec<T>
See StrSimWithTokenizer::tokenize_list
Source§impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: Tokenizer<T, Return = ByValue> + Display> StrSimWithTokenizer<T> for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: Tokenizer<T, Return = ByValue> + Display> StrSimWithTokenizer<T> for SeqStrSim<'t, T, SS, TK>
Source§fn similarity(&self, key: &str, query: &str) -> Result<f64, StrSimError>
fn similarity(&self, key: &str, query: &str) -> Result<f64, StrSimError>
Calculate the similarity between two strings. Usually, the similarity function is symmetric so
key and query can be swapped. However, some functions such as monge-elkan are not symmetric, so
key and query takes specific meaning: key is the value in the database and query is the search
query from the user. Read more
Source§fn similarity_pre_tok1(
&self,
key: &str,
tokenized_query: &T,
) -> Result<f64, StrSimError>
fn similarity_pre_tok1( &self, key: &str, tokenized_query: &T, ) -> Result<f64, StrSimError>
Calculate the similarity with the query’s already been pre-tokenized
Source§fn tokenize_list(&self, strs: &[&str]) -> Vec<T>
fn tokenize_list(&self, strs: &[&str]) -> Vec<T>
Tokenize a list of strings into a list of tokens used for this method.
Auto Trait Implementations§
impl<'t, T, SS, TK> Freeze for SeqStrSim<'t, T, SS, TK>where
SS: Freeze,
impl<'t, T, SS, TK> RefUnwindSafe for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS, TK> Send for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS, TK> Sync for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS, TK> Unpin for SeqStrSim<'t, T, SS, TK>
impl<'t, T, SS, TK> !UnwindSafe for SeqStrSim<'t, T, SS, TK>
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