The Levenshtein Edit Distance algorithm in Golang
This is a straight port of fast-levenshtein (npm) from JavaScript.
- As efficient as the original by not storing the whole matrix.
- Built UTF-8 aware
- Small, the go file is about 1 KB
- Easy to use, exposes only one function.
$ go get github.com/ravener/go-levenshtein
package main
import (
"fmt"
"github.com/pollen5/levenshtein"
)
func main() {
fmt.Println(levenshtein.Get("kitten", "sitting")) // => 3
// UTF-8 aware
fmt.Println(levenshtein.Get("Françe", "France")) // => 1
}