feat(core): drop trivial (short/sparse) phrase segments (#76, part 2) - #84
Conversation
Failing tests + stub for is_trivial_phrase: a phrase shorter than MIN_PHRASE_BARS (2) or carrying fewer than MIN_PHRASE_NOTES (2) notes should be dropped like a silent one — the playtest's "single bar of one chord / two alternating notes." Impl follows.
… paths (#76) is_trivial_phrase(bars, notes) is true when a segment spans < MIN_PHRASE_BARS (2) bars or carries < MIN_PHRASE_NOTES (2) notes; the web (split_segments_to_json) and CLI (chunks_for_segments) filters now drop these alongside the silent segments they already dropped. Visible cleanup: the DGD guitar split goes 13 → 11 phrases — the two stray 1-bar fragments are gone, every kept phrase now spans 2–12 bars. core split 10/10 (2 new); web split 5/5; cli green; clippy clean. Thresholds are deliberately conservative (a 2-note phrase is still kept) so existing fixtures stand — tunable as the corpus grows. Novelty dedup (the issue's third part) follows.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds two exported constants ( ChangesTrivial Phrase Filtering
Possibly Related Issues
Possibly Related PRs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@codex bro?? |
Summary
Testing
|
Part 2 of three for #76. After part 1 (over-long cap, #83) this drops the trivial phrases — the playtest's "single bar of one repeated chord / two alternating notes ('could be discarded')." On the DGD guitar track these were the two stray 1-bar fragments.
What
is_trivial_phrase(bars, notes)incore/src/split.rs: true when a segment spans fewer thanMIN_PHRASE_BARS(2) bars or carries fewer thanMIN_PHRASE_NOTES(2) notes.web/src/lib.rs(split_segments_to_json) andcli/src/main.rs(chunks_for_segments). A fully-silent segment is trivial on both counts, so this subsumes the oldnote_count == 0check.Approach
Genuine red → green (core algorithm):
8196e3dadds failing tests + anunimplemented!()stub;7f62bfdimplements it and wires the two filters.Thresholds
Deliberately conservative: a 2-note phrase is still kept, so the existing web/cli split fixtures stand unchanged. The one-bar cap (
MIN_PHRASE_BARS = 2) is what catches the issue's examples (both are single-bar);MIN_PHRASE_NOTESis the lone-note guard. Both are documented as tunable as the corpus grows.Verification
coresplit 10/10 (2 new: short/sparse → trivial, boundary 2-bar/2-note → kept); web split 5/5;cligreen;clippy -D warningsclean.[MIN, MAX]), no page errors.Part 3 — novelty dedup (flag near-duplicate phrases via
measure_novelty) — follows separately.🤖 Generated with Claude Code
https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
Generated by Claude Code
Summary by CodeRabbit