Function levenshtein_diff::edit::generate_edits [−][src]
pub fn generate_edits<T: Clone + PartialEq>(
source: &[T],
target: &[T],
distances: &DistanceMatrix
) -> Result<Vec<Edit<T>>, LevenshteinError>
Generate a vector of edits that, when applied to the source sequence, transform it into the target sequence.
Arguments
source- The source sequencetarget- The target sequencedistances- A reference to theDistanceMatrixfor converting source to target
Examples
use levenshtein_diff as levenshtein; let s1 = "SATURDAY"; let s2 = "SUNDAY"; let (_, matrix) = levenshtein::distance(s1.as_bytes(), s2.as_bytes()); // This can be used with the `apply_edits` function to transform source to target let edits = levenshtein::generate_edits(s1.as_bytes(), s2.as_bytes(), &matrix).unwrap();