[][src]Function triple_accel::levenshtein::levenshtein_exp

pub fn levenshtein_exp(a: &[u8], b: &[u8]) -> u32

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

This may be much more efficient than levenshtein if the number of edits between a and b is expected to be small. Internally, this will call levenshtein_simd_k 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 = levenshtein_exp(b"abc", b"ab");

assert!(dist == 1);