Overview
Architecture
The Grammar Engine coordinates eight specialized checkers:
Configuration
GrammarEngineConfig
GrammarRuleConfig
Load custom grammar rules from YAML:Grammar Rules
Rule Types
| Rule Type | Description | Example |
|---|---|---|
| Particle Typos | Common particle mistakes | ဘူ → ဘူး |
| Medial Confusions | Ya-pin vs Ya-yit | ကျောင်း → ကြောင်း |
| POS Sequences | Invalid tag combinations | N-N without particle |
| Verb-Particle | Verb ending agreement | Missing tense marker |
| Sentence Structure | Sentence completeness | Missing final particle |
Particle Typo Detection
Medial Confusion Detection
Detects common medial character confusions:| Confusion | Characters | Example |
|---|---|---|
| Ya-pin / Ya-yit | ျ / ြ | ကျောင်း / ကြောင်း |
| Wa-swe / Ha-htoe | ွ / ှ | နွေး (warm) / နှေး (slow) |
POS Sequence Validation
Validates POS tag sequences:| Sequence | Validity | Reason |
|---|---|---|
| N + V | Warning | Usually needs particle |
| V + V | Info | Except auxiliaries (SVC) |
| P_SENT + P_SENT | Error | Double sentence particles |
| N + P_SUBJ | Valid | Subject marking |
Verb-Particle Agreement
Sentence Structure Validation
Specialized Checkers
AspectChecker
Validates aspect markers (completion, continuation):ပြီ- Completionနေ- Continuationခဲ့- Pastမယ်- Future
ClassifierChecker
Validates Myanmar numeral classifiers:ယောက်- Peopleကောင်- Animalsလုံး- Round objectsခု- General objects
CompoundChecker
Validates compound words and reduplications:NegationChecker
Validates negation patterns:မ...ဘူး- Colloquial negativeမ...ပါ- Polite negativeမ...- Literary negative
RegisterChecker
Validates register consistency (formal vs colloquial):- Colloquial:
တယ်,ဘူး,မယ် - Formal:
သည်,ပါသည်,မည်,ပါမည်,၏
Integration with SpellChecker
The Grammar Engine integrates automatically via validation strategies when rule-based validation is enabled:GrammarEngineConfig) is managed internally. For advanced customization, use SyntacticRuleChecker directly with a custom config path.
Custom Rules
YAML Configuration
Loading Custom Rules
See Also
- Grammar Checkers - Individual checker details
- Validation Strategies - Strategy integration
- POS Tagging - POS tag reference
- Rules System - YAML rule files