Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lmas/Damerau-Levenshtein
This repo has been migrated to https://code.larus.se/lmas/Damerau-Levenshtein
https://github.com/lmas/Damerau-Levenshtein
damerau damerau-levenshtein-distance go levenshtein
Last synced: 29 days ago
JSON representation
This repo has been migrated to https://code.larus.se/lmas/Damerau-Levenshtein
- Host: GitHub
- URL: https://github.com/lmas/Damerau-Levenshtein
- Owner: lmas
- License: mit
- Archived: true
- Created: 2019-05-23T16:10:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-21T09:51:43.000Z (over 1 year ago)
- Last Synced: 2024-08-03T23:27:12.122Z (4 months ago)
- Topics: damerau, damerau-levenshtein-distance, go, levenshtein
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 11
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - Damerau-Levenshtein
README
Damerau-Levenshtein
================================================================================[![GoDoc](https://godoc.org/github.com/lmas/Damerau-Levenshtein?status.svg)](https://godoc.org/github.com/lmas/Damerau-Levenshtein)
Calculate and return the True Damerau–Levenshtein distance of string A and B.
See [Issue #2](https://github.com/lmas/Damerau-Levenshtein/issues/2) for a list
of research papers used as a reference when implementing the algorithm and a
minor struggle trying to verify the results.Example
--------------------------------------------------------------------------------Install package:
go get github.com/lmas/Damerau-Levenshtein
Get distance between string A and B:
package main
import (
"fmt"
tdl "github.com/lmas/Damerau-Levenshtein"
)func main() {
dist := tdl.Distance("CA", "ABC")
fmt.Println(dist)
}Or if you want more performant code and want to avoid memory allocations:
func main() {
// Set a max length of 100 characters for strings A and B
t := tdl.New(100)
dist := t.Distance("CA", "ABC")
fmt.Println(dist)
dist := t.Distance("AC", "ABC")
fmt.Println(dist)
}Take a look at the tests for more examples.
License
--------------------------------------------------------------------------------MIT License, see the LICENSE file.