Skip to main content
Each DictionaryProvider implementation supports a different subset of features depending on its underlying storage mechanism. Use the matrix below to choose the right provider for your use case.

Overview

The DictionaryProvider abstract base class defines the interface for dictionary data storage and retrieval. Different implementations offer different capabilities based on their underlying storage mechanism.

Capability Matrix

Legend

  • Full: Fully implemented with optimized performance
  • ⚠️ Optional: Supported if data is provided during initialization
  • Not Supported: Returns default value (0, None, or empty)
  • Default: Uses default implementation (iterates over individual calls)
  • Optimized: Uses batch queries for better performance

Provider Selection Guide

Best for:
  • Production deployments
  • Large dictionaries (100K+ entries)
  • Concurrent access from multiple threads
  • Full spell checking with context validation
Features:
  • Disk-based storage with memory-mapped I/O
  • Connection pooling for thread safety
  • Optimized batch queries
  • Full N-gram and POS support

MemoryProvider (Best for Testing/Development)

Best for:
  • Unit testing with controlled data
  • Development and debugging
  • Small dictionaries
  • Maximum performance (no I/O)
Features:
  • In-memory storage
  • Fast initialization
  • Full N-gram and POS support
  • No disk dependencies

JSONProvider (For Simple Use Cases)

Best for:
  • Simple dictionary files
  • Human-readable configuration
  • Small datasets
  • Testing with external data
Limitations:
  • N-gram and POS data supported only if provided in the JSON file
  • Not optimized for large datasets

CSVProvider (For Data Import)

Best for:
  • Importing from spreadsheets
  • Simple frequency lists
  • Data migration
Limitations:
  • N-gram and POS data supported only if provided in CSV files
  • Column-based format only

Method Behavior When Not Supported

When a method is not supported by a provider, it returns a safe default value:

Creating Custom Providers

To create a custom provider, extend DictionaryProvider and implement all abstract methods:
See src/myspellchecker/providers/base.py for the complete interface definition.