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

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

Returns the Levenshtein distance between two strings using SIMD acceleration.

Note that levenshtein_exp may be much faster if the number of edits between the two strings is expected to be small. Internally, this will call levenshtein_simd_k. 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(b"abc", b"ab");

assert!(dist == 1);