Documentation
¶
Overview ¶
Package suggest provides the shared "did you mean" primitives: a rune-aware Levenshtein edit distance and a prefix-weighted Closest ranker. It is the single home for these so cmd, cmd/event, and internal/cmdpolicy stop each carrying their own copy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Closest ¶
Closest returns up to maxN of candidates that plausibly match typed, ranked by shared-prefix length (desc) then edit distance (asc), keeping only reasonably-close ones.
Shared prefix is weighted first on purpose: hallucinated names are often semantically close but lexically far (e.g. "+cells-find" vs "+cells-search", "--with-styles" vs nothing close), where the common prefix is the strongest signal of intent that raw edit distance misses.
func Levenshtein ¶
Levenshtein computes the classic edit distance between two strings. It is rune-aware, so it is correct for multi-byte input.
Types ¶
This section is empty.