Class: OptimalStringAlignment

OptimalStringAlignment()

Class for calculating Optimal String Alignment (Levenshtein Distance) between strings.

Constructor

new OptimalStringAlignment()

Source:

Methods

(static) calculate(str1, str2, gapPenaltyopt) → {number}

Calculates the minimum number of edits required to transform one string to another.

Parameters:
Name Type Attributes Default Description
str1 string

The first string.

str2 string

The second string.

gapPenalty number <optional>
1

The penalty for gaps (insertions/deletions).

Source:
Returns:
  • The Levenshtein distance (number of edits).
Type
number