StrSimWithTokenizer

Trait StrSimWithTokenizer 

Source
pub trait StrSimWithTokenizer<T>: StrSim<T> {
    // Required methods
    fn similarity(&self, key: &str, query: &str) -> Result<f64, StrSimError>;
    fn similarity_pre_tok1(
        &self,
        key: &str,
        tokenized_query: &T,
    ) -> Result<f64, StrSimError>;
    fn tokenize(&self, str: &str) -> T;
    fn tokenize_list(&self, strs: &[&str]) -> Vec<T>;
}

Required Methods§

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.

The return value is a likelihood between 0 and 1.

§Arguments
  • key the value in the database (e.g., entity label)
  • query the search query from the user (e.g., cell in the table)
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.

Implementors§

Source§

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