Methods
(static) distance(str1, str2) → {number}
Calculates the Damerau-Levenshtein distance between two strings. This distance represents the minimum number of edit operations (insertion, deletion, substitution, transposition) needed to transform one string into another.
Parameters:
Name | Type | Description |
---|---|---|
str1 |
string | The first string. |
str2 |
string | The second string. |
- Source:
Returns:
- The Damerau-Levenshtein distance between the two strings.
- Type
- number
(static) similarity(str1, str2) → {number}
Calculates the similarity between two strings based on their Damerau-Levenshtein distance. Similarity is a value between 0.0 (completely different) and 1.0 (identical).
Parameters:
Name | Type | Description |
---|---|---|
str1 |
string | The first string. |
str2 |
string | The second string. |
- Source:
Returns:
- The similarity score between the two strings.
- Type
- number