Skip to main content
In Myanmar, many common errors involve swapping visually or phonetically similar words that are both valid dictionary entries. The homophone checker uses N-gram context probabilities to flag these “real-word errors” and suggest the contextually correct alternative.

Overview

Myanmar homophones often arise from:

HomophoneChecker

Constructor

Basic Usage

Common Homophone Pairs

Custom Homophone Map

With Provider (DB Confusable Pairs)

The provider parameter enables DB-driven confusable pair lookup via get_confusable_pairs(). The DB source provides ~21K pairs (aspiration, medial, nasal, tone swaps) and is the primary source. The YAML source is a curated fallback for pairs that corpus mining cannot discover.

Load from Config

Homophone Validation Strategy

The HomophoneValidationStrategy uses context to detect homophone errors:

Configuration Parameters

Improvement ratios and probability thresholds are managed internally by NgramContextChecker.compute_required_ratio(), not passed directly to the strategy constructor.

How It Works

  1. For each word, check if it has homophones
  2. Analyze surrounding context (N-gram probabilities)
  3. If a homophone has higher probability in context, flag as error
  4. Suggest the contextually appropriate homophone

Minimum Probability Threshold

The NgramContextChecker applies a minimum probability threshold internally to prevent false positives from infrequent N-gram occurrences:
This prevents false suggestions when a homophone appears rarely in the training data.

Example Detection

Integration with SpellChecker

Homophone checking is automatically enabled with context validation:

Homophones YAML Configuration

Homophones are defined in rules/homophones.yaml:
Context disambiguation is handled automatically via N-gram probabilities at the strategy level, so no per-entry disambiguation context is needed in the YAML.

Structure

Best Practices

  1. Enable with context: Homophones need context for accurate detection
  2. Review suggestions: Homophone detection has moderate confidence
  3. Add domain-specific pairs: Extend homophones.yaml for your domain
  4. Use with N-grams: N-gram probabilities improve accuracy

Performance

  • Homophone lookup: O(1) hash table
  • Context analysis: Depends on N-gram checker
  • Memory: Minimal (homophone map is small)

See Also