Function triple_accel::levenshtein::rdamerau_exp[][src]

pub fn rdamerau_exp(a: &[u8], b: &[u8]) -> u32
Expand description

Returns the restricted Damerau-Levenshtein distance between two strings using exponential search and SIMD acceleration.

This may be much more efficient than rdamerau if the number of edits between a and b is expected to be small. Internally, this will call levenshtein_simd_k_with_opts with values of k determined through exponential search. If AVX2 or SSE4.1 is not supported, then this will automatically fall back to a scalar alternative.

Arguments

  • a - first string (slice)
  • b - second string (slice)

Example

let dist = rdamerau_exp(b"abc", b"acb");

assert!(dist == 1);