Skip to main content
If you need direct access to SymSpell lookups or the semantic checker outside of the full SpellChecker pipeline, whether for benchmarking, custom workflows, or embedding in other tools, AlgorithmFactory gives you configured instances with built-in LRU caching (10-100x speedup on repeated lookups).

Overview

AlgorithmFactory Class

Central factory for all spell checking algorithms:

Factory Methods

create_symspell

Creates a SymSpell instance with dictionary lookup caching:
Usage:

create_semantic_checker

Creates an ONNX-based semantic checker:
Usage:

Cached Wrappers

CachedDictionaryLookup

Wraps dictionary lookups with LRU caching:

CachedBigramSource

Wraps bigram lookups with functools.lru_cache:

CachedPOSRepository

Wraps POS lookups with caching:

Performance Benefits

Speedup by Operation

Memory Usage

Integration with SpellChecker

The factory integrates with the main SpellChecker:

Manual Factory Usage

Configuration

Factory Configuration

Per-Algorithm Configuration

Best Practices

1. Reuse Factory Instances

2. Clear Provider Caches When Needed

See Also