Skip to main content
This section documents every algorithm in the library — from O(1) SymSpell lookups through Viterbi decoding to optional ONNX-based semantic models — along with their complexity characteristics and tuning parameters.

Overview

mySpellChecker uses a multi-layered approach with specialized algorithms at each level:

Contents

Core Algorithms

Suggestion System

Context & Grammar

POS and Tagging

Text Processing

Entity & Pattern Recognition

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