Skip to main content

ratio

Function ratio 

Source
pub fn ratio(a: &str, b: &str) -> f64
Expand description

Fast exact difflib ratio. Bit-identical to difflib.SequenceMatcher(None, a, b, autojunk=False).ratio().

Dispatches by length: short inputs take the lightweight difflib b2j recursion (cheap to set up), long inputs take the suffix-automaton LCS (frequency-independent, so it doesn’t degrade on repetitive text). Both paths are exact and agree bit-for-bit.