Skip to content

fix: make segment joins seam-aware#13

Merged
bukinoshita merged 2 commits into
mainfrom
fix/seam-aware-segment-joins-6fbb
Jul 6, 2026
Merged

fix: make segment joins seam-aware#13
bukinoshita merged 2 commits into
mainfrom
fix/seam-aware-segment-joins-6fbb

Conversation

@bukinoshita

@bukinoshita bukinoshita commented Jul 5, 2026

Copy link
Copy Markdown
Member

Summary by cubic

Make segment joins seam-aware to prevent illegal consonant clusters, vowel pileups, and bad final letters. Inserts tiny linking phonemes and updating finals; sampled outputs show illegal starts/ends and 3+ vowel runs drop to ~0 with a small uniqueness gain.

  • Bug Fixes
    • Validate C+C seams against whitelists and insert a linking vowel when illegal (INITIAL_CLUSTERS, MEDIAL_CLUSTERS).
    • For V+V seams, block 3+ runs and aa/ii/uu by inserting l/n/r.
    • Special-case qu so it is followed by exactly one vowel; repair with vowel or vowel+consonant bridges.
    • Remove illegal finals by updating CODAS/RIMES (no word ends in j, q, w, h, v).
    • Replace raw concatenation in buildPattern with joinSegments; add can-join and cluster utilities with tests.

Written for commit 2b738d6. Summary will update on new commits.

Review in cubic

cursoragent and others added 2 commits July 5, 2026 21:47
…da, ech rime)

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
…l pileups with linking phonemes

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
@bukinoshita bukinoshita changed the title fix: make segment joins seam-aware (BU-2307) fix: make segment joins seam-aware Jul 5, 2026
@bukinoshita bukinoshita marked this pull request as ready for review July 5, 2026 21:54

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 11 files

Linked issue analysis

Linked issue: BU-2307: 2. Make segment joins seam-aware (no illegal clusters or vowel pileups across seams)

Status Acceptance criteria Notes
Validate C+C seams against initial/medial whitelists (disallow illegal consonant clusters at seams). PR adds INITIAL_CLUSTERS and MEDIAL_CLUSTERS, canJoin uses them, and tests cover both unit cases and sampled words to ensure no illegal initial/medial clusters.
Prevent vowel+vowel seams that create runs of 3+ vowels or banned vowel pairs (aa/ii/uu). canJoin enforces vowel-run constraints and banned pairs; joinSegments inserts linking consonants; unit tests verify both canJoin and join behavior and sampled words show none of these vowel errors.
Special-case qu so it is followed by exactly one vowel (repair when needed). canJoin checks left.endsWith('qu') and joinSegments provides QU_LINKING_BRIDGES/QU_LINKING_VOWELS; tests exercise qu+consonant and qu+vowel cases.
Remove or restrict illegal finals so no word ends in j, q, w, h, or v. phoneme arrays were updated to drop illegal finals and tests assert CODAS/RIMES/TAILS contain no entries ending in those letters; sampled words tests assert no outputs end with those letters.
Replace raw concatenation in buildPattern with joinSegments and add can-join/cluster utilities and tests. buildPattern now delegates to joinSegments; new utilities (can-join, clusters) and many unit tests were added, and joinSegments behavior is covered by deterministic and behavioral tests.
⚠️ Acceptance criterion: illegal word-start and word-end cluster rates drop to ~0 on a 200k-word sample. The PR adds thorough unit tests and sampled-word assertions that show zero offenders on the provided samples, but the tests/sample sizes are much smaller than the 200k-word sample specified in the issue (pattern.spec samples ~500 per pattern; generator tests sample up to 5k). The claimed large-sample measurement is not shown in the repo tests here.

Re-trigger cubic

@bukinoshita bukinoshita merged commit eaf6efb into main Jul 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants