calliope-ts 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -3
- package/dist/calliope/bracketing.d.ts.map +1 -1
- package/dist/calliope/bracketing.js +59 -5
- package/dist/calliope/deps.d.ts +5 -1
- package/dist/calliope/deps.d.ts.map +1 -1
- package/dist/calliope/deps.js +53 -3
- package/dist/calliope/engine.d.ts.map +1 -1
- package/dist/calliope/engine.js +6 -1
- package/dist/calliope/relstress.d.ts.map +1 -1
- package/dist/calliope/relstress.js +411 -15
- package/dist/calliope/syntax.d.ts +33 -0
- package/dist/calliope/syntax.d.ts.map +1 -1
- package/dist/calliope/syntax.js +199 -0
- package/dist/data/en_common_words.json +1 -0
- package/dist/display.d.ts +15 -1
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +112 -10
- package/dist/fabbhalle.d.ts +54 -0
- package/dist/fabbhalle.d.ts.map +1 -0
- package/dist/fabbhalle.js +404 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -33
- package/dist/phonological.d.ts.map +1 -1
- package/dist/phonological.js +7 -1
- package/dist/rewriteEn.d.ts +14 -0
- package/dist/rewriteEn.d.ts.map +1 -0
- package/dist/rewriteEn.js +392 -0
- package/dist/rhyme.d.ts +35 -3
- package/dist/rhyme.d.ts.map +1 -1
- package/dist/rhyme.js +176 -11
- package/dist/russian/accentuator.d.ts +31 -0
- package/dist/russian/accentuator.d.ts.map +1 -0
- package/dist/russian/accentuator.js +546 -0
- package/dist/russian/collocations.d.ts +7 -0
- package/dist/russian/collocations.d.ts.map +1 -0
- package/dist/russian/collocations.js +38 -0
- package/dist/russian/compounds.d.ts +6 -0
- package/dist/russian/compounds.d.ts.map +1 -0
- package/dist/russian/compounds.js +81 -0
- package/dist/russian/download.d.ts +23 -0
- package/dist/russian/download.d.ts.map +1 -0
- package/dist/russian/download.js +117 -0
- package/dist/russian/engine.d.ts +6 -0
- package/dist/russian/engine.d.ts.map +1 -0
- package/dist/russian/engine.js +1424 -0
- package/dist/russian/parser.d.ts +8 -0
- package/dist/russian/parser.d.ts.map +1 -0
- package/dist/russian/parser.js +92 -0
- package/dist/russian/paths.d.ts +55 -0
- package/dist/russian/paths.d.ts.map +1 -0
- package/dist/russian/paths.js +114 -0
- package/dist/russian/rewrite.d.ts +6 -0
- package/dist/russian/rewrite.d.ts.map +1 -0
- package/dist/russian/rewrite.js +400 -0
- package/dist/russian/rhyme.d.ts +18 -0
- package/dist/russian/rhyme.d.ts.map +1 -0
- package/dist/russian/rhyme.js +230 -0
- package/dist/russian/syllabifier.d.ts +14 -0
- package/dist/russian/syllabifier.d.ts.map +1 -0
- package/dist/russian/syllabifier.js +475 -0
- package/dist/russian/types.d.ts +94 -0
- package/dist/russian/types.d.ts.map +1 -0
- package/dist/russian/types.js +27 -0
- package/dist/scandroidNative/constants.d.ts +16 -0
- package/dist/scandroidNative/constants.d.ts.map +1 -0
- package/dist/scandroidNative/constants.js +60 -0
- package/dist/scandroidNative/deduceParameters.d.ts +16 -0
- package/dist/scandroidNative/deduceParameters.d.ts.map +1 -0
- package/dist/scandroidNative/deduceParameters.js +69 -0
- package/dist/scandroidNative/dictionary-data.d.ts +2 -0
- package/dist/scandroidNative/dictionary-data.d.ts.map +1 -0
- package/dist/scandroidNative/dictionary-data.js +744 -0
- package/dist/scandroidNative/dictionary.d.ts +12 -0
- package/dist/scandroidNative/dictionary.d.ts.map +1 -0
- package/dist/scandroidNative/dictionary.js +50 -0
- package/dist/scandroidNative/engine.d.ts +41 -0
- package/dist/scandroidNative/engine.d.ts.map +1 -0
- package/dist/scandroidNative/engine.js +119 -0
- package/dist/scandroidNative/machine.d.ts +93 -0
- package/dist/scandroidNative/machine.d.ts.map +1 -0
- package/dist/scandroidNative/machine.js +795 -0
- package/dist/scandroidNative/positioner.d.ts +32 -0
- package/dist/scandroidNative/positioner.d.ts.map +1 -0
- package/dist/scandroidNative/positioner.js +208 -0
- package/dist/scandroidNative/syllabizer.d.ts +3 -0
- package/dist/scandroidNative/syllabizer.d.ts.map +1 -0
- package/dist/scandroidNative/syllabizer.js +215 -0
- package/dist/scandroidNative/utilities.d.ts +37 -0
- package/dist/scandroidNative/utilities.d.ts.map +1 -0
- package/dist/scandroidNative/utilities.js +86 -0
- package/dist/scansion.d.ts.map +1 -1
- package/dist/scansion.js +118 -14
- package/dist/stress.d.ts +1 -0
- package/dist/stress.d.ts.map +1 -1
- package/dist/stress.js +502 -42
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +27 -6
- package/tools/fetch-russian-data.mjs +30 -0
- package/webapp/public/app.js +2418 -0
- package/webapp/public/assets/GithubLogo.png +0 -0
- package/webapp/public/assets/NPM2.png +0 -0
- package/webapp/public/assets/fonts/MurenaBold-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/MurenaItalic-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/MurenaRegular-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/Myra_4F_Caps_Bold-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/SinkinSans-700Bold.otf +0 -0
- package/webapp/public/assets/fonts/butterflies.ttf +0 -0
- package/webapp/public/assets/fonts/midcase_blackline-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/neueral-bold-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/neueral-regular-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/popelka-webfont.woff2 +0 -0
- package/webapp/public/assets/fonts/vremenagrotesk-webfont.woff +0 -0
- package/webapp/public/assets/fonts/wicky_javick_bold-webfont.woff2 +0 -0
- package/webapp/public/assets/logos/Logo_Var_10_Celtic_Knot_SVG.svg +116 -0
- package/webapp/public/assets/logos/Logo_Var_11_Graph_SVG.svg +313 -0
- package/webapp/public/assets/logos/Logo_Var_12_Limacon_Knot_SVG.svg +3942 -0
- package/webapp/public/assets/logos/Logo_Var_13_Crescents_SVG.svg +1030 -0
- package/webapp/public/assets/logos/Logo_Var_1_Spiral_SVG.svg +1491 -0
- package/webapp/public/assets/logos/Logo_Var_2_Tunnel_SVG.svg +12 -0
- package/webapp/public/assets/logos/Logo_Var_3_Triskelion_SVG.svg +10 -0
- package/webapp/public/assets/logos/Logo_Var_4_Quinquetra_PNG.png +0 -0
- package/webapp/public/assets/logos/Logo_Var_5_Penrose_Pentagram_SVG.svg +37 -0
- package/webapp/public/assets/logos/Logo_Var_6_Triskelion2_SVG.svg +10 -0
- package/webapp/public/assets/logos/Logo_Var_7_SixfoldSpirals_SVG.svg +20 -0
- package/webapp/public/assets/logos/Logo_Var_8_Radial_Labyrinth_SVG.svg +163 -0
- package/webapp/public/assets/logos/Logo_Var_9_Radial_Labyrinth_2_SVG.svg +106 -0
- package/webapp/public/index.html +316 -0
- package/webapp/public/styles.css +1114 -0
- package/webapp/server.mjs +680 -0
- package/src/caesura.ts +0 -201
- package/src/calliope/boundaries.ts +0 -190
- package/src/calliope/bracketing.ts +0 -390
- package/src/calliope/deps.ts +0 -160
- package/src/calliope/engine.ts +0 -77
- package/src/calliope/feats.ts +0 -46
- package/src/calliope/names.ts +0 -44
- package/src/calliope/postag.ts +0 -253
- package/src/calliope/prosodic.ts +0 -262
- package/src/calliope/relstress.ts +0 -645
- package/src/calliope/stressrules.ts +0 -147
- package/src/calliope/syntax.ts +0 -218
- package/src/calliope/udpos.ts +0 -152
- package/src/calliope_src_contents.md +0 -19049
- package/src/clio/caesura.ts +0 -145
- package/src/clio/depfix.ts +0 -88
- package/src/clio/display.ts +0 -1042
- package/src/clio/engine.ts +0 -38
- package/src/clio/parser.ts +0 -845
- package/src/clio/phonological.ts +0 -849
- package/src/clio/phrasestress.ts +0 -108
- package/src/clio/pipeline.ts +0 -154
- package/src/clio/rhyme.ts +0 -740
- package/src/clio/scandroid.ts +0 -434
- package/src/clio/scansion.ts +0 -1130
- package/src/clio/semantics.ts +0 -134
- package/src/clio/stress.ts +0 -1731
- package/src/clio/tagfix.ts +0 -104
- package/src/depfix.ts +0 -88
- package/src/display.ts +0 -1138
- package/src/engine.ts +0 -22
- package/src/index.ts +0 -690
- package/src/parser.ts +0 -501
- package/src/phonological.ts +0 -917
- package/src/phrasestress.ts +0 -108
- package/src/rhyme.ts +0 -748
- package/src/scandroid.ts +0 -434
- package/src/scansion.ts +0 -1174
- package/src/semantics.ts +0 -134
- package/src/stress.ts +0 -2111
- package/src/tagfix.ts +0 -104
- package/src/types.ts +0 -265
- package/tests/DataForHayesLinesOnly.txt +0 -364
- package/tests/DataForHayesStressSymbolsRevised.txt +0 -728
- package/tests/basic.test.ts +0 -1102
- package/tests/bench-hayes.mjs +0 -72
- package/tests/epg64.meter.train.txt +0 -8139
- package/tests/litlab-sample-2016.txt +0 -1738
- package/tests/prosodic.meter.train.txt +0 -13192
- package/tests/wagner-stress.test.ts +0 -188
- package/tsconfig.json +0 -29
- package/vitest.config.d.ts +0 -2
- package/vitest.config.js +0 -14
package/tests/bench-hayes.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// bench-hayes.mjs — relative-stress benchmark against the maintainer's revised
|
|
2
|
-
// Hayes English-folk-song corpus (tests/DataForHayesStressSymbolsRevised.txt),
|
|
3
|
-
// whose per-syllable x/w/n/m/s patterns were re-marked BY EAR (sung aloud) in our
|
|
4
|
-
// gradience nomenclature. This is ground truth for the Calliope relative-stress
|
|
5
|
-
// engine — not a meter fixture.
|
|
6
|
-
//
|
|
7
|
-
// node tests/bench-hayes.mjs # summary
|
|
8
|
-
// node tests/bench-hayes.mjs --worst 20 # + the N worst-disagreeing lines
|
|
9
|
-
// node tests/bench-hayes.mjs --clio # benchmark the frozen Clio engine
|
|
10
|
-
//
|
|
11
|
-
// Metrics (on lines whose engine syllable count matches the marking):
|
|
12
|
-
// BEAT agreement = fraction of syllables where engine and ear agree on
|
|
13
|
-
// is-this-a-beat (relative stress >= m). The headline number.
|
|
14
|
-
// exact / within-1 = tier-level agreement on x<w<n<m<s.
|
|
15
|
-
// strong-adjacencies = engine count of abutting beats (the ear's corpus has 0).
|
|
16
|
-
|
|
17
|
-
import { readFileSync } from 'fs';
|
|
18
|
-
import { fileURLToPath } from 'url';
|
|
19
|
-
import { dirname, join } from 'path';
|
|
20
|
-
|
|
21
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const useClio = process.argv.includes('--clio');
|
|
23
|
-
const worstN = (() => { const i = process.argv.indexOf('--worst'); return i >= 0 ? +process.argv[i + 1] || 10 : 0; })();
|
|
24
|
-
|
|
25
|
-
const { analyzeText } = await import(join(here, '..', 'dist', 'index.js'));
|
|
26
|
-
const { analyzeTextClio } = await import(join(here, '..', 'dist', 'clio', 'pipeline.js'));
|
|
27
|
-
const analyze = useClio ? analyzeTextClio : analyzeText;
|
|
28
|
-
|
|
29
|
-
const RANK = { x: 0, w: 1, n: 2, m: 3, s: 4 };
|
|
30
|
-
const isBeat = (c) => RANK[c] >= 3;
|
|
31
|
-
|
|
32
|
-
const lines = readFileSync(join(here, 'DataForHayesStressSymbolsRevised.txt'), 'utf8').split(/\r?\n/);
|
|
33
|
-
const rows = [];
|
|
34
|
-
let curText = null;
|
|
35
|
-
for (const ln of lines) {
|
|
36
|
-
const t = ln.match(/line text\s+(.*\S)\s*$/);
|
|
37
|
-
const p = ln.match(/stress pattern\s+([xwnms=]+)\s*$/);
|
|
38
|
-
if (t) curText = t[1];
|
|
39
|
-
if (p && curText) { rows.push({ text: curText, pat: p[1].replace(/[^xwnms]/g, '') }); curText = null; }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let aligned = 0, mismatch = 0, beatAgree = 0, beatTot = 0, exact = 0, within1 = 0, tierTot = 0, strongAdj = 0;
|
|
43
|
-
const diffs = [];
|
|
44
|
-
for (const r of rows) {
|
|
45
|
-
const res = analyze(r.text, false);
|
|
46
|
-
const seq = res.flatMap(x => x.sentence.words.flatMap(w => w.syllables.map(s => s.relativeStress ?? 'w')));
|
|
47
|
-
const wrd = res.flatMap(x => x.sentence.words.flatMap(w => w.syllables.map(() => w.word)));
|
|
48
|
-
if (seq.length !== r.pat.length) { mismatch++; continue; }
|
|
49
|
-
aligned++;
|
|
50
|
-
for (let i = 0; i + 1 < seq.length; i++) if (isBeat(seq[i]) && isBeat(seq[i + 1])) strongAdj++;
|
|
51
|
-
let mism = 0; const detail = [];
|
|
52
|
-
for (let i = 0; i < seq.length; i++) {
|
|
53
|
-
const e = RANK[seq[i]], u = RANK[r.pat[i]];
|
|
54
|
-
tierTot++; if (e === u) exact++; if (Math.abs(e - u) <= 1) within1++;
|
|
55
|
-
beatTot++; if (isBeat(seq[i]) === isBeat(r.pat[i])) beatAgree++;
|
|
56
|
-
else { mism++; detail.push((isBeat(seq[i]) ? '+' : '-') + wrd[i] + '(' + seq[i] + '/' + r.pat[i] + ')'); }
|
|
57
|
-
}
|
|
58
|
-
if (mism) diffs.push({ mism, text: r.text, detail });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const pct = (a, b) => (100 * a / b).toFixed(1) + '%';
|
|
62
|
-
console.log(`engine: ${useClio ? 'Clio (frozen)' : 'Calliope'}`);
|
|
63
|
-
console.log(`rows ${rows.length} · aligned ${aligned} · syllable-count mismatch ${mismatch}`);
|
|
64
|
-
console.log(`BEAT agreement ${pct(beatAgree, beatTot)}`);
|
|
65
|
-
console.log(`exact tier ${pct(exact, tierTot)}`);
|
|
66
|
-
console.log(`within-1 tier ${pct(within1, tierTot)}`);
|
|
67
|
-
console.log(`engine strong-adjacencies ${strongAdj} (ear corpus: 0)`);
|
|
68
|
-
if (worstN) {
|
|
69
|
-
console.log(`\nworst ${worstN} lines (engine-tier/ear-tier; + = engine over-beats, - = engine misses):`);
|
|
70
|
-
diffs.sort((a, b) => b.mism - a.mism);
|
|
71
|
-
for (const d of diffs.slice(0, worstN)) console.log(`${d.mism} ${d.text}\n ${d.detail.join(' ')}`);
|
|
72
|
-
}
|