Datasets:
Download evaluation/pitch-name-normalization.test.mjs from bryel-labs/MuSP-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/datasets/bryel-labs/MuSP-Bench/resolve/main/evaluation/pitch-name-normalization.test.mjs
- Command line
-
hf download hf://datasets/bryel-labs/MuSP-Bench/evaluation/pitch-name-normalization.test.mjs
-
curl -L -o pitch-name-normalization.test.mjs https://huggingface.co/datasets/bryel-labs/MuSP-Bench/resolve/main/evaluation/pitch-name-normalization.test.mjs
1.94 kB
| import test from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import {matchesAcceptedAnswer,canonicalizePitchSequence} from './answer-normalization.mjs'; | |
| test('vertical-bar list delimiters preserve content, order, and multiplicity',()=>{ | |
| assert.equal(matchesAcceptedAnswer('D minor | G major | C major | C minor','D minor, G major, C major, C minor'),true); | |
| assert.equal(matchesAcceptedAnswer('F7 | F#7 | F7','F7, Gb7, F7'),true); | |
| assert.equal(matchesAcceptedAnswer('00:32 | 1:05','0:32, 1:05'),true); | |
| assert.equal(matchesAcceptedAnswer('G major | D minor','D minor, G major'),false); | |
| assert.equal(matchesAcceptedAnswer('F7 | F#7 | F7','F7, Gb7'),false); | |
| }); | |
| test('hyphenated and spaced accidental names retain pitch identity',()=>{ | |
| for(const [answer,reference] of [['E-flat','D#'],['E flat','Eb'],['F-sharp','Gb'],['C-double-sharp','D'],['E-double-flat','D'],['E-natural','E']]) { | |
| assert.equal(matchesAcceptedAnswer(answer,reference),true,`${answer} / ${reference}`); | |
| } | |
| }); | |
| test('named accidentals preserve octave and pitch differences',()=>{ | |
| assert.equal(matchesAcceptedAnswer('E-flat4','D#4'),true); | |
| assert.equal(matchesAcceptedAnswer('B-sharp3','C4'),true); | |
| assert.equal(matchesAcceptedAnswer('E-flat5','D#4'),false); | |
| assert.equal(matchesAcceptedAnswer('E-flat','E'),false); | |
| assert.equal(matchesAcceptedAnswer('E-natural4','Eb4'),false); | |
| }); | |
| test('pitch lists preserve ordering and repeated notes',()=>{ | |
| assert.equal(matchesAcceptedAnswer('E-flat4, F-sharp4','D#4, Gb4'),true); | |
| assert.equal(matchesAcceptedAnswer('E-flat4, F-sharp4','Gb4, D#4'),false); | |
| assert.equal(matchesAcceptedAnswer('E-flat4, E-flat4','D#4'),false); | |
| }); | |
| test('negative octaves and non-pitch words are not accidental names',()=>{ | |
| assert.equal(canonicalizePitchSequence('C-1'),'pitches:n0'); | |
| assert.equal(canonicalizePitchSequence('E-flatness'),null); | |
| assert.equal(canonicalizePitchSequence('A-sharpener'),null); | |
| }); | |