editdist(X;Y)
Returns the Levenshtein edit distance between two given strings.
Syntax
editdist(X;Y)
Input
Argument | Type | Description |
---|---|---|
X |
text | The string on which to apply the function A scalar value or the name of a column |
Y |
text | The string (or the name of a column containing string values) to transform
X into |
Return Value
The result is the integer value corresponding to the Levenshtein edit distance between
X
and Y
. The Levenshtein edit distance is the minimum
number of edits (defined as insertions, deletions, or single-character substitutions)
required to transform one string into the other.
If X
or Y
is N/A, the result is the length of the other
argument.
Sample Usage
value1 |
value2 |
editdist(value1;value2) |
---|---|---|
'cat' | 'rat' | 1 |
'apples' | 'oranges' | 5 |
'apples' | 'apples' | 0 |
Additional Information
- This function does not work with Unicode (UTF-8) strings.
- For a Unicode-compliant alternative, consider
strdist(X;Y;M;N)
.