query
On this page

levenshtein

lib.strings.levenshtein

Docs pulled from | This Revision | 17 minutes ago


Computes the Levenshtein distance between two strings a and b.

Complexity O(n*m) where n and m are the lengths of the strings. Algorithm adjusted from https://stackoverflow.com/a/9750974/6605742

Inputs

a
1. Function argument
b
2. Function argument

Type

levenshtein :: string -> string -> int

Examples

lib.strings.levenshtein usage example

levenshtein "foo" "foo"
=> 0
levenshtein "book" "hook"
=> 1
levenshtein "hello" "Heyo"
=> 3