Why Grammar Checking?
Myanmar text can have:- Correct spelling but wrong particles: “သူ ကို” vs “သူ က”
- Verb-modifier mismatches: Wrong causative or passive markers
- Sentence structure errors: Missing required components
- Pass syllable validation (valid syllables)
- Pass word validation (valid words)
- Fail syntactic rules
How It Works
Grammar Rules
Particle Rules
Subject Particle (က)
Object Particle (ကို)
Location Particles (မှာ, တွင်)
Verb Modifier Rules
Causative Construction
Passive Construction
Sentence Structure Rules
Configuration
Enable Grammar Checking
Grammar Rule Configuration
Grammar checking is configured throughGrammarEngineConfig:
SyntacticRuleChecker:
Built-in Grammar Checkers
The grammar system includes several specialized checkers:| Checker | Description |
|---|---|
AspectChecker | Validates verb aspect markers |
ClassifierChecker | Validates numeral classifiers |
CompoundChecker | Validates compound word patterns |
MergedWordChecker | Detects incorrectly merged particle+verb sequences |
NegationChecker | Validates negation patterns |
RegisterChecker | Detects formal/informal register mixing |
YAML Rules Configuration
Grammar rules are defined in YAML files located insrc/myspellchecker/rules/:
| File | Purpose |
|---|---|
grammar_rules.yaml | Core syntactic grammar rules |
typo_corrections.yaml | Common typo patterns and corrections |
particles.yaml | Particle definitions with POS tags |
classifiers.yaml | Numeral classifier rules |
register.yaml | Formal/informal register rules |
compounds.yaml | Compound word patterns |
aspects.yaml | Verb aspect rules |
negation.yaml | Negation pattern rules |
GrammarRuleConfig:
Error Types and Severity
| Severity | Description | Example |
|---|---|---|
error | Definite grammatical error | Wrong particle type |
warning | Likely error, may be valid | Unusual construction |
info | Style suggestion | Missing optional particle |
Error Response
API Reference
SyntacticRuleChecker
Individual Grammar Checkers
Common Patterns
Filter by Confidence
Grammar-Only Check
Report Grammar Issues
Built-in Rules
POS Sequence Rules
Errors
| Pattern | Description | Confidence |
|---|---|---|
| P_SENT P_SENT | Double sentence ending particles | 0.98 |
| P_PAST P_FUT | Conflicting tense markers | 0.98 |
| V P_NEG | Negation prefix after verb (wrong order — should be မ + V) | 0.95 |
| P_POSS P_SUBJ | Possessive + subject adjacent (noun missing between them) | 0.95 |
| P_POSS P_OBJ | Possessive + object adjacent (noun missing between them) | 0.95 |
Warnings
| Pattern | Description | Confidence |
|---|---|---|
| P_SUBJ P_OBJ | Subject + object markers adjacent | 0.90 |
| P_OBJ P_SUBJ | Object + subject markers adjacent | 0.90 |
| P_LOC P_LOC | Multiple location particles | 0.85 |
| P V | Particle directly precedes verb | 0.85 |
| PPM V | Postpositional marker before verb | 0.75 |
| NUM N | Number before noun without classifier | 0.75 |
| NUM V | Number before verb without classifier | 0.75 |
| N V | Noun + verb without case particle | 0.75 |
| ADJ V | Adjective before verb without noun | 0.65 |
Info
| Pattern | Description | Confidence |
|---|---|---|
| V V | Consecutive verbs (may be serial verb construction) | 0.50 |
| P P | Consecutive particles (check compatibility) | 0.50 |
| PPM PPM | Consecutive postpositional markers | 0.50 |
| PART PART | Consecutive particles | 0.50 |
| N N | Consecutive nouns (may be compound noun) | 0.40 |
| PART V | Particle before verb (may be auxiliary) | 0.40 |
| PPM N | Postpositional marker before noun (may be embedded clause) | 0.40 |
| N INT | Noun + interjection (vocative/exclamation) | 0.40 |
| INT INT | Consecutive interjections (emphatic) | 0.30 |
| INT P | Interjection + particle | 0.20 |
Sentence Boundary Rules
Forbidden Sentence Starts
| Particles | Type | Severity | Confidence |
|---|---|---|---|
ကို, ရဲ့, အတွက် | Object / possessive / benefactive | error | 0.90 |
မှ, ကနေ, လို့, ဆိုလို့ | Source / causative | error | 0.85 |
လည်း, တော့, ပဲ | Conjunctive | warning | 0.70 |
Forbidden Sentence Ends
| Particles | Type | Severity | Confidence |
|---|---|---|---|
က, ကို, နှင့်, နဲ့ | Case markers | error | 0.90 |
ရဲ့, ၏, မှ, ကနေ | Possessive / source | error | 0.90 |
အတွက်, အလို့ငှာ | Benefactive | warning | 0.75 |
Sentence Completion Rules
| Pattern | Required Ending | Severity | Confidence |
|---|---|---|---|
| V$ (verb at sentence end) | တယ်, ပါတယ်, သည်, ပါသည်, မယ်, ပါမယ်, ပြီ | warning | 0.80 |
| N V (noun before verb) | က, ကို, မှာ, မှ, သည် (case particle between them) | warning | 0.75 |
Architecture
The Grammar Engine coordinates six specialized checkers throughSyntacticRuleChecker:

Confidence Scoring
Grammar suggestions include confidence scores based on context:| Factor | Weight | Description |
|---|---|---|
| Exact match | 0.95 | Exact pattern match |
| Verb context | 0.90 | After verb validation |
| Noun context | 0.85 | After noun validation |
| Default | 0.80 | No specific context |
| Context dependent | 0.65 | Ambiguous context |
Troubleshooting
Issue: Too many false positives
Cause: POS tagging errors or overly strict rules Solution:Issue: Missing grammar errors
Cause: Grammar checkers not enabled Solution: Enable grammar checking in config:Issue: Slow grammar checking
Cause: Complex rules or many patterns Solution: Raise confidence thresholds to reduce processing via GrammarEngineConfig:Next Steps
- POS Tagging - Underlying tagging system
- Semantic Checking - AI-powered deep checking
- Custom Rules - Create your own rules