Class: Kotoshu::Components::PassthroughSpellChecker
- Inherits:
-
SpellChecker
- Object
- SpellChecker
- Kotoshu::Components::PassthroughSpellChecker
- Defined in:
- lib/kotoshu/components/passthrough_spell_checker.rb
Overview
Passthrough spell checker for languages that don't use spell checking.
This checker always returns that words are "found" (correct). It's used for languages that don't have traditional spell checking, such as:
- CJK languages (Japanese, Chinese) - use confusion rules instead
- Languages with purely rule-based checking
Instance Method Summary collapse
-
#check(_word) ⇒ Hash
Always returns that the word is "found" (correct).
-
#correct?(_word) ⇒ Boolean
Always returns true (all words are "correct").
-
#initialize(reason: nil) ⇒ PassthroughSpellChecker
constructor
Create a new passthrough spell checker.
-
#passthrough? ⇒ Boolean
Check if this is a passthrough checker.
-
#reason ⇒ String
Get the reason why spell checking is not used.
-
#suggest(_word, _max_suggestions: 10) ⇒ Array<Hash>
Returns no suggestions.
Constructor Details
#initialize(reason: nil) ⇒ PassthroughSpellChecker
Create a new passthrough spell checker.
24 25 26 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 24 def initialize(reason: nil) @reason = reason || "Language does not use spell checking" end |
Instance Method Details
#check(_word) ⇒ Hash
Always returns that the word is "found" (correct).
32 33 34 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 32 def check(_word) { found: true, stem: nil, flags: [] } end |
#correct?(_word) ⇒ Boolean
Always returns true (all words are "correct").
51 52 53 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 51 def correct?(_word) true end |
#passthrough? ⇒ Boolean
Check if this is a passthrough checker.
65 66 67 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 65 def passthrough? true end |
#reason ⇒ String
Get the reason why spell checking is not used.
58 59 60 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 58 def reason @reason end |
#suggest(_word, _max_suggestions: 10) ⇒ Array<Hash>
Returns no suggestions.
Passthrough spell checkers don't provide suggestions.
43 44 45 |
# File 'lib/kotoshu/components/passthrough_spell_checker.rb', line 43 def suggest(_word, _max_suggestions: 10) [] end |