fix: length-aware pattern selection and syllable-boundary trimming#14
fix: length-aware pattern selection and syllable-boundary trimming#14bukinoshita wants to merge 11 commits into
Conversation
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
There was a problem hiding this comment.
5 issues found across 12 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
Addresses cubic review: pad.ts, join-segments.ts and can-join.ts each had their own isVowel; trim-to-fit.ts duplicated trailingConsonantRun. Also replaces the recursive appendPadding with a bounded reduce so padding no longer depends on call-stack depth. Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Recomputing fit weights for all 16 patterns on every call doubled generation cost; caching the candidate list per (min, max) brings 1M-word generation from ~4.2s to ~1.9s and keeps the 1M uniqueness test well under its timeout. Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
There was a problem hiding this comment.
2 issues found across 9 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 18 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
… prefix fits Addresses cubic review: with maxLength 2 a word like 'whanere' trimmed to 'wh' and skipped padding since minLength was already met, leaking an illegal ending. trimToFit now returns an empty string when no prefix ends legally, letting padToLength rebuild a legal word from padding syllables. Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Addresses cubic review: appendPadding allocated an array proportional to the initial length deficit. Padding now proceeds in chunks of at most 1024 steps, keeping allocation constant while preserving the exact RNG sequence. Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Requires human review: The PR modifies core name generation logic with new pattern selection, trimming, and padding algorithms; risk of breakage in an important utility.
Re-trigger cubic
Summary by cubic
Respect name length ranges and trim at syllable-safe boundaries. This addresses BU-2308 by cutting truncation and eliminating illegal endings.
selectPatternwith precomputedPATTERN_LENGTH_STATSto favor patterns whose expected length fits[minLength, maxLength], penalize overshoot, and preserve variety. Falls back to default weights when nothing fits.trimToFitandFINAL_CLUSTERSto cut overlong words at legal boundaries (no split clusters, no nakedq, no illegal final letters).padToLengthto trim first, then pad usingcanJoinand a length budget to avoid illegal seams.Written for commit a07dcbc. Summary will update on new commits.