ravener / go-levenshtein

Levenshtein implementation for Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Levenshtein

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.

Install

$ go get github.com/ravener/go-levenshtein

Usage

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
}

License

MIT

About

Levenshtein implementation for Golang

License:MIT License


Languages

Language:Go 100.0%