Use words package from minio for DamerauLevenshteinDistance() (#2075)
This commit is contained in:
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Minio Client (C) 2014, 2015 Minio, Inc.
|
||||
* Minio Client (C) 2014, 2015, 2016, 2017 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/minio/pkg/probe"
|
||||
"github.com/minio/minio/pkg/words"
|
||||
"github.com/pkg/profile"
|
||||
)
|
||||
|
||||
@@ -237,7 +238,7 @@ func findClosestCommands(command string) []string {
|
||||
continue
|
||||
}
|
||||
// 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))
|
||||
}
|
||||
}
|
||||
|
||||
Generated
Vendored
+3
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Minio Client (C) 2014-2016 Minio, Inc.
|
||||
* Minio Client (C) 2014, 2015, 2016, 2017 Minio, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,11 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
package words
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
import "math"
|
||||
|
||||
// Returns the minimum value of a slice of integers
|
||||
func minimum(integers []int) (minVal int) {
|
||||
Vendored
+6
@@ -108,6 +108,12 @@
|
||||
"revision": "8912b6bf3b22ff668b6448742cd50e7b837182ec",
|
||||
"revisionTime": "2017-02-10T19:51:41Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "+lLm3Uz721j8WzlV813lWiATrXM=",
|
||||
"path": "github.com/minio/minio/pkg/words",
|
||||
"revision": "7ebf11b20233d0eba0f1a28dbd124e7fdd44aee2",
|
||||
"revisionTime": "2017-03-19T21:23:05Z"
|
||||
},
|
||||
{
|
||||
"path": "github.com/pkg/profile",
|
||||
"revision": "19396ecfda37c1c9ddaa52019adca59d582e4832",
|
||||
|
||||
Reference in New Issue
Block a user