Overview
mySpellChecker uses a multi-layered approach with specialized algorithms at each level:Contents
Core Algorithms
- SymSpell - O(1) spelling correction algorithm
- Edit Distance - Levenshtein, Damerau-Levenshtein, weighted algorithms
- N-gram Model - Statistical language modeling
- Viterbi - POS tagging with HMM
Suggestion System
- Suggestion Strategy - Pluggable suggestion generation interface
- Suggestion Ranking - Multi-factor ranking algorithms
Context & Grammar
- Context-Aware Validation - Context and grammar validation overview
- Grammar Rules - Syntactic grammar rule engine
- Semantic Analysis - Neural semantic validation
POS and Tagging
- POS Disambiguator - Context-based POS disambiguation rules
- Joint Segment Tagger - Unified segmentation and POS tagging
- Tone Disambiguation - Context-aware tone mark inference
Text Processing
- Normalization - Text preprocessing and Unicode handling
- Segmentation - Word segmentation algorithms
- Syllable Segmentation - Rule-based syllable breaking
Entity & Pattern Recognition
- Named Entity Recognition - Heuristic NER for proper nouns
- Phonetic Matching - Sound-based similarity matching
Algorithm Selection
When to Use Each Algorithm
The validation pipeline processes text through these stages in order:Performance Characteristics
Time Complexity
*k = number of rule checks; N = sequence length, B = beam width, T = avg tags per word (beam pruning reduces from O(nT²))
Space Complexity
Implementation Notes
Cython Optimizations
Performance-critical algorithms are implemented in Cython:Cython Word Segmentation
The word segmenter (word_segment.pyx) uses Viterbi decoding with C++ unordered_map for O(1) probability lookups and memory-mapped model loading for fork-safe parallel processing:
Quick Reference
Algorithm Parameters
Tuning Guidelines
- Speed priority: Use edit distance 1, disable context
- Accuracy priority: Use edit distance 2, enable context
- Memory constrained: Use SQLite provider, disable semantic
See Also
- Architecture Overview - System design
- Performance Tuning - Optimization guide
- API Reference - Programmatic access