https://github.com/ferhatelmas/levenshtein
Levenshtein distance in Golang
https://github.com/ferhatelmas/levenshtein
Last synced: about 2 months ago
JSON representation
Levenshtein distance in Golang
- Host: GitHub
- URL: https://github.com/ferhatelmas/levenshtein
- Owner: ferhatelmas
- License: mit
- Created: 2016-05-18T14:06:57.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-18T14:33:08.000Z (about 9 years ago)
- Last Synced: 2025-03-18T08:22:27.508Z (2 months ago)
- Language: Go
- Size: 1.95 KB
- Stars: 10
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Levenshtein Distance in Golang
[](https://godoc.org/github.com/ferhatelmas/levenshtein)
[](https://travis-ci.org/ferhatelmas/levenshtein)> Calculate levenshtein distance in Golang.
## Install
By go tool: `go get github.com/ferhatelmas/levenshtein`
## Usage
This uses default calculator which has cost of 1 for additions, deletions and substitutions.
```go
import github.com/ferhatelmas/levenshteinlevenshtein.Dist("aaa", "ab") // 2
```You can specify different weights to increment/deletion and substitutions.
```go
levenshtein.New(1, 1).Dist("aaa", "ab") // 2
levenshtein.New(1, 2).Dist("aaa", "ab") // 3
levenshtein.New(1, 3).Dist("aaa", "ab") // 3
levenshtein.New(1, 4).Dist("aaa", "ab") // 3
levenshtein.New(2, 2).Dist("aaa", "ab") // 4
levenshtein.New(3, 2).Dist("aaa", "ab") // 5
```## LICENSE
MIT © [Ferhat Elmas](https://github.com/ferhatelmas)