words: new package Damerau Levenshtein distance function. (#3929)

This commit is contained in:
Bala FA
2017-03-20 02:53:05 +05:30
committed by Harshavardhana
parent 1c97dcb10a
commit 7ebf11b202
3 changed files with 8 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/console"
"github.com/minio/minio/pkg/trie"
"github.com/minio/minio/pkg/words"
)
// global flags for minio.
@@ -86,7 +87,7 @@ func newApp() *cli.App {
}
// 2 is arbitrary and represents the max
// allowed number of typed errors
if DamerauLevenshteinDistance(command, value.(string)) < 2 {
if words.DamerauLevenshteinDistance(command, value.(string)) < 2 {
closestCommands = append(closestCommands, value.(string))
}
}