This commit is contained in:
ldlda committed 2025-01-08 03:59:41 +07:00
1 parent fbe0743d27
commit 726104fd54
3 files changed
+4 -5

No files matched your search

+2 -2
View File
@@ -167,7 +167,7 @@ pub fn levenshtein_with_operations(
(dp[len1][len2].cost, dp)
}
pub fn edit_sequence(dp: &Vec<Vec<CostOperation>>, str1: &str, str2: &str) -> Vec<EditOperation> {
pub fn edit_sequence(dp: &[Vec<CostOperation>], str1: &str, str2: &str) -> Vec<EditOperation> {
let mut i = str1.len();
let mut j = str2.len();
let mut funny = vec![];
@@ -202,7 +202,7 @@ pub fn edit_sequence(dp: &Vec<Vec<CostOperation>>, str1: &str, str2: &str) -> Ve
pub fn generate_alignment(
str1: &str,
str2: &str,
operations: &Vec<Vec<CostOperation>>,
operations: &[Vec<CostOperation>],
) -> (String, String) {
let mut aligned_str1 = String::new();
let mut aligned_str2 = String::new();
+1 -2
View File
@@ -1,6 +1,6 @@
use std::fmt::Display;
use lda_levenshtein::*;
use lda_strdist::*;
struct EditOperationVec<'e>(&'e Vec<EditOperation>);
@@ -28,7 +28,6 @@ fn main() {
reconstruct_from(&reconstructed),
reconstruct_to(&reconstructed)
);
let (d2, dp) = levenshtein_with_operations(str1, str2, &EditCost::default());
assert!(d2 == distance);