1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
// -----------------------------------------------------------------------------
//
/// The `StrSimType` string similarity type is used to select a string
/// similarity metric implemented by the `strsim` crate. This allows fuzzy
/// searching.
///
/// Indicium relies on Danny Guo's [strsim](https://crates.io/crates/strsim)
/// string similarity crate for fuzzy matching.
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum StrSimType {
/// Like optimal string alignment, but substrings can be edited an unlimited
/// number of times, and the triangle inequality holds.
DamerauLevenshtein,
/// Calculates the Jaro similarity between two sequences. The returned value
/// is between 0.0 and 1.0 (higher value means more similar).
Jaro,
/// Like Jaro but gives a boost to sequences that have a common prefix.
JaroWinkler,
/// Calculates the minimum number of insertions, deletions, and
/// substitutions required to change one string into the other.
Levenshtein,
/// Calculates a Sørensen-Dice similarity distance using bigrams.
/// See <http://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient>.
SorensenDice,
} // StrSimType