Prerequisite: You must build a dictionary database before spell checking will work. mySpellChecker does not include a bundled dictionary.
Setup
Before checking spelling, you need a dictionary database:./mySpellChecker-default.db in the current directory. For production, build from your own corpus:
Your First Spell Check
Quick Check (One-liner)
Standard Usage
Understanding Results
Thecheck() method returns a Response object:
Error Types
mySpellChecker identifies several types of errors:| Error Type | Value | Description | Example |
|---|---|---|---|
ErrorType.SYLLABLE | invalid_syllable | Invalid syllable structure | Misspelled character combinations |
ErrorType.WORD | invalid_word | Valid syllables but unknown word | Compound word errors |
ErrorType.GRAMMAR | grammar_error | Syntactic/grammar issues | Wrong particle usage |
ErrorType.CONTEXT_PROBABILITY | context_probability | Low probability word sequence | ”Rice go” instead of “Rice eat” |
Validation Levels
Control the depth of checking with validation levels at check time:
Note: Validation level is specified per-check via the level parameter, not in configuration.
Getting Suggestions
Access correction suggestions for errors:Batch Processing
Process multiple texts efficiently:Async Processing
For web applications and async workflows:Using with FastAPI
Context Manager Usage
Ensure proper resource cleanup:Custom Database
Use your own dictionary database:Configuration Presets
Use built-in presets for common scenarios:"development", "production", "testing", "fast", "accurate"
CLI Usage
Check text from command line:Colloquial Handling
Control how colloquial (informal) spellings are handled:Localized Error Messages
Display error messages in Myanmar:Streaming Large Files
Process large files with bounded memory:Text Normalization
Always normalize input for consistent results:Zawgyi Detection
Handle legacy Zawgyi encoding:Error Handling
Handle errors gracefully with specific exception types:Summary Table
| Use Case | Method | Speed |
|---|---|---|
| Quick check | check_text(text) | Convenient |
| Single text | checker.check(text) | Fast |
| Multiple texts | checker.check_batch(texts) | Faster (batched) |
| Async single | await checker.check_async(text) | Non-blocking |
| Async batch | await checker.check_batch_async(texts) | Non-blocking, batched |
| Large files | streaming.check_stream(file) | Memory-bounded |
| Fast validation | checker.check(text, level=ValidationLevel.SYLLABLE) | Fastest |
| Full validation | checker.check(text, level=ValidationLevel.WORD) | More thorough |
Next Steps
- Configuration Guide - Customize behavior
- API Reference - Complete API documentation
- Performance Tuning - Optimize for your use case
- Custom Dictionaries - Build domain-specific dictionaries