Documentation
¶
Overview ¶
Package fuzzy provides fuzzy string matching utilities using a multi-tier matching algorithm (exact → substring → word boundary → Levenshtein distance).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSuggestions ¶
FormatSuggestions formats a list of suggestion names into a readable string.
Types ¶
type BestResult ¶
type BestResult struct {
Found bool // True if a match was found
ID int // The matched item's ID (0 if not found)
Name string // The matched item's name (empty if not found)
Score float64 // Match score (0 if not found)
Error string // Error message with suggestions (empty if found)
}
BestResult represents the result of a Best() call.
type NamedItem ¶
NamedItem represents an item with an ID and Name for fuzzy matching. Items must implement this interface to be searchable.
type NamedItemString ¶
NamedItemString is a simple implementation of NamedItem for string-based items.
func (NamedItemString) GetID ¶
func (n NamedItemString) GetID() int
func (NamedItemString) GetName ¶
func (n NamedItemString) GetName() string
type Options ¶
type Options struct {
MaxResults int // Maximum number of results to return (default: 5)
Threshold float64 // Minimum score threshold 0.0-1.0 (default: 0.5)
}
Options configures the fuzzy search behavior.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns Options with sensible defaults.
Click to show internal directories.
Click to hide internal directories.