Documentation ¶
Overview ¶
package ld implements levenshtein distance in order to provide suggestions based on similarity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Suggestions ¶
Suggestions takes in an input and a set of valid options. It returns a set of suggested values based on the levenshtein distance between them. The distanceCutoff can be used to control the required similarity of the option to the input for it to be included in the suggestions.
func SuggestionsWithOverride ¶
func SuggestionsWithOverride(input string, options []string, distanceCutoff int, ignoreCase bool, override func(input, option string) bool) []string
SuggestionsWithOverride is similar to Suggestions, except it takes an optional include function. If the distance is less than the cutoff, the passed override function will be invoked, and if it returns true, the option will be added to the suggestions list. This allows custom suggestion logic to be added.
Types ¶
This section is empty.