use std::collections::HashMap; use std::hash::Hash;
usesuper::DiffableStrRef;
// quick and dirty way to get an upper sequence ratio. pubfn upper_seq_ratio<T: PartialEq>(seq1: &[T], seq2: &[T]) -> f32 { let n = seq1.len() + seq2.len(); if n == 0 { 1.0
} else { 2.0 * seq1.len().min(seq2.len()) as f32 / n as f32
}
}
/// Internal utility to calculate an upper bound for a ratio for /// [`get_close_matches`]. This is based on Python's difflib approach /// of considering the two sets to be multisets. /// /// It counts the number of matches without regard to order, which is an /// obvious upper bound. pubstruct QuickSeqRatio<'a, T: DiffableStrRef + ?Sized>(HashMap<&'a T, i32>);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.