class
Oxide::Utils::SuggestionList
- Oxide::Utils::SuggestionList
- Reference
- Object
Overview
Provides fuzzy matching suggestions using Levenshtein distance algorithm. Used to generate "Did you mean?" messages for GraphQL errors.
Defined in:
oxide/utils/suggestion_list.crConstant Summary
-
MAX_SUGGESTIONS =
5
Class Method Summary
-
.did_you_mean_message(suggestions : Array(String)) : String | Nil
Formats suggestions into a "Did you mean?" message.
-
.suggest(input : String, options : Array(String)) : Array(String)
Returns up to 5 best matches from options based on Levenshtein distance.
Class Method Detail
def self.did_you_mean_message(suggestions : Array(String)) : String | Nil
#
Formats suggestions into a "Did you mean?" message. Returns nil if no suggestions provided.
def self.suggest(input : String, options : Array(String)) : Array(String)
#
Returns up to 5 best matches from options based on Levenshtein distance. Uses a threshold of 40% of input length to filter suggestions.