Overview
SuggestionStrategy Protocol
The core protocol defining the suggestion interface:SuggestionContext
Context information for generating suggestions:Creating Context
SuggestionResult
Results from suggestion generation:Accessing Results
BaseSuggestionStrategy
Base class with common functionality:Implementing a Custom Strategy
CompositeSuggestionStrategy
Combines multiple strategies with unified ranking:Using Composite Strategy
Context Support
Strategy Types
Morpheme-Level Strategy
Corrects typos inside compound words and reduplications by fixing individual morphemes:CompositeSuggestionStrategy pipeline
when ReduplicationEngine or CompoundResolver are enabled. Suggestions use
source="morpheme" with confidence 0.80-0.85, weighted by source_weight_morpheme=0.85
in RankerConfig.
Edit Distance Strategies
Context-Aware Strategies
Phonetic Strategies
Semantic Strategies
Batch Processing
Integration
With SpellChecker
Suggestion strategies are not passed directly toSpellChecker. Instead, they are
wired internally via the WordValidator, which receives a CompositeSuggestionStrategy
through the DI container and factory system:
SpellCheckerConfig and
pass it to SpellChecker. The WordValidator internally creates and composes
strategies (SymSpell, Morphology, Compound, Morpheme, Context) based on the
config and available components.
With Algorithm Factory
See Also
- Suggestion Ranking - Ranking algorithms
- SymSpell Algorithm - Edit distance suggestions
- Context Checking - N-gram context
- Algorithm Factory - Strategy creation