levenshtein

package
v2.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxDist = xerrors.New("levenshtein: maxDist exceeded")

Functions

func Distance

func Distance(a, b string, maxDist int) (int, error)

Distance returns the edit distance between a and b using the Wagner-Fischer algorithm. A and B must be less than 255 characters long. maxDist is the maximum distance to consider. A value of -1 for maxDist means no maximum.

func Matches

func Matches(needle string, maxDistance int, haystack ...string) (matches []string)

Matches returns the closest matches to the needle from the haystack. The maxDistance parameter is the maximum Matches distance to consider. If no matches are found, an empty slice is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL