fix: make segment joins seam-aware#13
Merged
Merged
Conversation
…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>
There was a problem hiding this comment.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
INITIAL_CLUSTERS,MEDIAL_CLUSTERS).aa/ii/uuby insertingl/n/r.quso it is followed by exactly one vowel; repair with vowel or vowel+consonant bridges.CODAS/RIMES(no word ends inj,q,w,h,v).buildPatternwithjoinSegments; addcan-joinand cluster utilities with tests.Written for commit 2b738d6. Summary will update on new commits.