Module: SpellKit
- Defined in:
- lib/spellkit.rb,
lib/spellkit/version.rb
Defined Under Namespace
Classes: Checker, Configuration, DownloadError, Error, FileNotFoundError, InvalidArgumentError, NotLoadedError
Constant Summary
collapse
- DEFAULT_DICTIONARY_URL =
Default dictionary: SymSpell English 80k frequency dictionary
"https://raw.githubusercontent.com/wolfgarbe/SymSpell/master/SymSpell.FrequencyDictionary/en-80k.txt"
- VERSION =
"0.1.2"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.default ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/spellkit.rb', line 56
def default
@default ||= begin
checker = Checker.new
checker.load!(dictionary: DEFAULT_DICTIONARY_URL)
checker
end
end
|
Class Method Details
48
49
50
51
52
53
54
|
# File 'lib/spellkit.rb', line 48
def configure
config = Configuration.new
yield(config)
@default = Checker.new
@default.load!(**config.to_h)
@default
end
|
.correct(word) ⇒ Object
79
80
81
|
# File 'lib/spellkit.rb', line 79
def correct(word)
default.correct(word)
end
|
.correct?(word) ⇒ Boolean
75
76
77
|
# File 'lib/spellkit.rb', line 75
def correct?(word)
default.correct?(word)
end
|
.correct_tokens(tokens) ⇒ Object
83
84
85
|
# File 'lib/spellkit.rb', line 83
def correct_tokens(tokens)
default.correct_tokens(tokens)
end
|
.healthcheck ⇒ Object
91
92
93
|
# File 'lib/spellkit.rb', line 91
def healthcheck
default.healthcheck
end
|
.load!(**options) ⇒ Object
65
66
67
68
69
|
# File 'lib/spellkit.rb', line 65
def load!(**options)
@default = Checker.new
@default.load!(**options)
@default
end
|
.stats ⇒ Object
87
88
89
|
# File 'lib/spellkit.rb', line 87
def stats
default.stats
end
|
.suggestions(word, max = 5) ⇒ Object
71
72
73
|
# File 'lib/spellkit.rb', line 71
def suggestions(word, max = 5)
default.suggestions(word, max)
end
|