Skip to main content
Word segmenters occasionally split a syllable across two tokens — for example, breaking “ကျောင်း” into [“ကျော”, “င်း”]. This module detects such fragments by checking syllable validity, then merges them back with the preceding token while guarding against double-ending artifacts.

Overview

Problem Statement

Myanmar word segmentation can produce invalid splits:
The repair module detects and fixes these splits by:
  1. Identifying invalid syllable fragments
  2. Merging fragments with preceding words
  3. Validating merged results

SegmentationRepair Class

Repair Algorithm

Detection Criteria

A token is identified as a fragment if:
  1. Invalid Start: Starts with a dependent character (not consonant/vowel/numeral)
  2. Suspicious Fragment: In the known problematic fragments list
  3. Invalid Syllable: Fails syllable structure validation

Merge Rules

Fragments are merged with the previous token if all of these conditions are met (this logic is inline in repair(), not a separate method):
  1. Merge wouldn’t create a double-ending pattern (checked via _would_create_double_ending())
  2. Previous token is not “closed” (doesn’t end with း, ့, ်)
  3. Merged result passes syllable validation

Double-Ending Prevention

Prevents invalid merges like “တွင်” + “င်း” → “တွင်င်း”:

Examples

Basic Repair

Preserving Valid Tokens

Numeral Handling

Closed Syllable Protection

Integration

With Data Pipeline

With SpellChecker

Segmentation repair is handled internally by the data pipeline’s CorpusSegmenter. It is not a user-configurable option in SpellCheckerConfig. The repair logic runs automatically during dictionary building to fix common segmentation errors.

Suspicious Fragments

Commonly misidentified fragments:

Closing Characters

Characters that indicate a syllable is complete:

Performance

Cython Optimization

For high-performance scenarios, use the Cython version:

See Also