← string_distance operator page · string/string_distance/levenshtein_sc/one_deletion

One deletion 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

string_distance(levenshtein, SC_1, SC_2) with SC_1 = foo and SC_2 = fo, the Levenshtein distance of two scalars.

Manual:

String distances: "Returns the Levenshtein distance, which is the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another.", as in string_distance(levenshtein, "foo", "fo") gives 1.

Expected:

SC_r is 1, a Number: delete the last o.

script.vtl ⇩

SC_r := string_distance(levenshtein, SC_1, SC_2);

input/scalars.csv ⇩

SC_1SC_2
foofo

input/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_1", "type": "String"},
    {"name": "SC_2", "type": "String"}
  ]
}

expected/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_r", "type": "Number", "value": 1}
  ]
}