Skip to main content
Grammar checking validates syntactic correctness using POS tags and rule-based analysis. It operates at Layer 2.5 in the validation pipeline, sitting between word validation and context checking. It catches errors where every word is spelled correctly but the sentence structure is wrong.

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
Grammar checking catches these errors that:
  • Pass syllable validation (valid syllables)
  • Pass word validation (valid words)
  • Fail syntactic rules

How It Works

1

POS Tagging

Text is tagged with part-of-speech labels:
2

Rule Application

Grammar rules check tag sequences:
3

Error Generation

Invalid sequences generate grammar errors:

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 through GrammarEngineConfig:
For advanced use, access the internal SyntacticRuleChecker:

Built-in Grammar Checkers

The grammar system includes several specialized checkers:

YAML Rules Configuration

Grammar rules are defined in YAML files located in src/myspellchecker/rules/: Load custom rules via GrammarRuleConfig:
GrammarRuleConfig does not have a morphotactics_path parameter. The morphotactics.yaml file is loaded internally by the grammar engine.
All paths are optional. When omitted, the built-in YAML files from src/myspellchecker/rules/ are used.

Error Types and Severity

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

Warnings

Info

Sentence Boundary Rules

Forbidden Sentence Starts

Forbidden Sentence Ends

Sentence Completion Rules

Architecture

The Grammar Engine coordinates eight specialized checkers through SyntacticRuleChecker: SyntacticRuleChecker architecture with eight specialized checkers: Aspect, Classifier, Compound, Merged Word, Negation, Particle, Tense Agreement, and Register Each checker handles a specific grammar domain. See Grammar Checkers for details on each one.

Confidence Scoring

Grammar suggestions include confidence scores based on context: Confidence scores are included in the GrammarError objects returned by check():

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