SeqStrSim

Struct SeqStrSim 

Source
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: SS

Implementations§

Source§

impl<'t, T, SS: StrSim<T> + Display + ExpectTokenizerType, TK: BaseTokenizer<T, Return = ByValue> + Display> SeqStrSim<'t, T, SS, TK>

Source

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>

Source§

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>

Source§

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>

See StrSimWithTokenizer::similarity_pre_tok1
Source§

fn tokenize(&mut self, str: &str) -> T

See StrSimWithTokenizer::tokenize
Source§

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>

Source§

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>

Calculate the similarity with the query’s already been pre-tokenized
Source§

fn tokenize(&self, str: &str) -> T

Tokenize a string into a tokens used for this method.
Source§

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>
where SS: Send, TK: Send, T: Send,

§

impl<'t, T, SS, TK> Sync for SeqStrSim<'t, T, SS, TK>
where SS: Sync, TK: Sync, T: Sync,

§

impl<'t, T, SS, TK> Unpin for SeqStrSim<'t, T, SS, TK>
where SS: Unpin, T: Unpin,

§

impl<'t, T, SS, TK> !UnwindSafe for SeqStrSim<'t, T, SS, TK>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,