Added preconfigured Options allowing for Sub

DefaultOptions has substitution cost 2, for historical reasons. Added
DefaultOptionsWithSub to give the more common behavior with
substitution cost 1.

Also extracted the default match function for convenience and added two
test cases.

Fixes #11.
2 files changed
tree: a699e205c3272cb936f67f052e595d1fd334e59f
  1. levenshtein/
  2. .gitignore
  3. LICENSE
  4. README.md
README.md

golang-levenshtein

An implementation of the Levenshtein algorithm in Go. Provides edit distances, edit scripts and ratios for strings (slices of runes).

Installation

$ go get github.com/texttheater/golang-levenshtein/levenshtein

Documentation

The documentation can be viewed online here: https://godoc.org/github.com/texttheater/golang-levenshtein/levenshtein

See also

For a package that is similar but more generic and provides more control, check out Daniël de Kok’s editdistance.