suggest

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identifiers added in v0.20.0

func Identifiers(input string, candidates []string, n int) []string

Identifiers returns up to n candidates closest to the input, for short names such as column names. The fractional gate Suggest uses is too tight for them: a one-character slip in a three-character name already exceeds a quarter of its length, so "N5O" would suggest nothing. A candidate qualifies here when either name contains the other or their case-insensitive edit distance is at most 2, the bound cobra applies to command names. Results are ordered by distance, then by the order the candidates were given.

func Suggest

func Suggest(input string, species []string, n int) []string

Suggest returns up to n species names closest to the input, limited to plausible near-spellings (see plausible). It returns nothing when no candidate is close, so callers can distinguish "did you mean X?" from "no such name exists here". Levenshtein distance is computed case-insensitively; substring matches get their distance halved as a relevance boost.

Types

This section is empty.

Jump to

Keyboard shortcuts

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