class DidYouMean::TreeSpellChecker
spell checker for a dictionary that has a tree structure, see doc/tree_spell_checker_api.md
Attributes
augment[R]
dictionary[R]
dimensions[R]
separator[R]
Public Class Methods
new(dictionary:, separator: '/', augment: nil)
click to toggle source
# File did_you_mean/tree_spell_checker.rb, line 7 def initialize(dictionary:, separator: '/', augment: nil) @dictionary = dictionary @separator = separator @augment = augment @dimensions = parse_dimensions end
Public Instance Methods
correct(input)
click to toggle source
# File did_you_mean/tree_spell_checker.rb, line 14 def correct(input) plausibles = plausible_dimensions input return no_idea(input) if plausibles.empty? suggestions = find_suggestions input, plausibles return no_idea(input) if suggestions.empty? suggestions end