Documentation
¶
Overview ¶
Package cmdsim provides functionality for finding the best matching command based on the Jaro-Winkler distance algorithm.
Index ¶
Constants ¶
const DefaultSimilarityThreshold = 0.7
DefaultSimilarityThreshold is the default similarity threshold for the Jaro-Winkler distance.
Variables ¶
This section is empty.
Functions ¶
func FindBestMatch ¶
FindBestMatch finds the best matching string to the input
func FindBestMatchFunc ¶
func FindBestMatchFunc[F ~func(K, V) string, K, V any](seq iter.Seq2[K, V], input string, threshold float64, fn F) string
FindBestMatchFunc finds the best matching value and its similarity score from the given list of values. It returns the best match and its similarity score. If no command meets the threshold, it returns an zero key and zero similarity score.
func IsASCIIIdentifier ¶
IsASCIIIdentifier checks if a string is a valid ascii identifier.
func JaroWinklerDistance ¶
JaroWinklerDistance calculates the Jaro-Winkler distance between two strings. The result is a value between 0 and 1, where 1 indicates a perfect match. This function is case-sensitive.
Types ¶
This section is empty.