devela::_dep::stringzilla::sz

Function edit_distance_utf8

pub fn edit_distance_utf8<F, S>(first: F, second: S) -> usize 
where F: AsRef<[u8]>, S: AsRef<[u8]>,
Available on crate feature dep_stringzilla only.
Expand description

Computes the Levenshtein edit distance between two UTF8 strings, using the Wagner-Fisher algorithm. This measure is widely used in applications like spell-checking.

§Arguments

  • first: The first byte slice.
  • second: The second byte slice.

§Returns

A usize representing the minimum number of single-character edits (insertions, deletions, or substitutions) required to change first into second.