calliope-ts 0.0.2 → 0.0.3
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 +3 -13
- package/dist/caesura.d.ts +33 -0
- package/dist/caesura.d.ts.map +1 -0
- package/dist/caesura.js +202 -0
- package/dist/calliope/boundaries.d.ts +19 -0
- package/dist/calliope/boundaries.d.ts.map +1 -0
- package/dist/calliope/boundaries.js +182 -0
- package/dist/calliope/bracketing.d.ts +11 -0
- package/dist/calliope/bracketing.d.ts.map +1 -0
- package/dist/calliope/bracketing.js +416 -0
- package/dist/calliope/deps.d.ts +4 -0
- package/dist/calliope/deps.d.ts.map +1 -0
- package/dist/calliope/deps.js +181 -0
- package/dist/calliope/engine.d.ts +3 -0
- package/dist/calliope/engine.d.ts.map +1 -0
- package/dist/calliope/engine.js +71 -0
- package/dist/calliope/feats.d.ts +9 -0
- package/dist/calliope/feats.d.ts.map +1 -0
- package/dist/calliope/feats.js +45 -0
- package/dist/calliope/names.d.ts +7 -0
- package/dist/calliope/names.d.ts.map +1 -0
- package/dist/calliope/names.js +42 -0
- package/dist/calliope/postag.d.ts +8 -0
- package/dist/calliope/postag.d.ts.map +1 -0
- package/dist/calliope/postag.js +250 -0
- package/dist/calliope/prosodic.d.ts +3 -0
- package/dist/calliope/prosodic.d.ts.map +1 -0
- package/dist/calliope/prosodic.js +275 -0
- package/dist/calliope/relstress.d.ts +4 -0
- package/dist/calliope/relstress.d.ts.map +1 -0
- package/dist/calliope/relstress.js +688 -0
- package/dist/calliope/stressrules.d.ts +28 -0
- package/dist/calliope/stressrules.d.ts.map +1 -0
- package/dist/calliope/stressrules.js +147 -0
- package/dist/calliope/syntax.d.ts +38 -0
- package/dist/calliope/syntax.d.ts.map +1 -0
- package/dist/calliope/syntax.js +234 -0
- package/dist/calliope/udpos.d.ts +13 -0
- package/dist/calliope/udpos.d.ts.map +1 -0
- package/dist/calliope/udpos.js +156 -0
- package/dist/clio/caesura.d.ts +27 -0
- package/dist/clio/caesura.d.ts.map +1 -0
- package/dist/clio/caesura.js +148 -0
- package/dist/clio/depfix.d.ts +13 -0
- package/dist/clio/depfix.d.ts.map +1 -0
- package/dist/clio/depfix.js +84 -0
- package/dist/clio/display.d.ts +32 -0
- package/dist/clio/display.d.ts.map +1 -0
- package/dist/clio/display.js +976 -0
- package/dist/clio/engine.d.ts +3 -0
- package/dist/clio/engine.d.ts.map +1 -0
- package/dist/clio/engine.js +28 -0
- package/dist/clio/parser.d.ts +10 -0
- package/dist/clio/parser.d.ts.map +1 -0
- package/dist/clio/parser.js +696 -0
- package/dist/clio/phonological.d.ts +41 -0
- package/dist/clio/phonological.d.ts.map +1 -0
- package/dist/clio/phonological.js +788 -0
- package/dist/clio/phrasestress.d.ts +6 -0
- package/dist/clio/phrasestress.d.ts.map +1 -0
- package/dist/clio/phrasestress.js +106 -0
- package/dist/clio/pipeline.d.ts +11 -0
- package/dist/clio/pipeline.d.ts.map +1 -0
- package/dist/clio/pipeline.js +147 -0
- package/dist/clio/rhyme.d.ts +65 -0
- package/dist/clio/rhyme.d.ts.map +1 -0
- package/dist/clio/rhyme.js +761 -0
- package/dist/clio/scandroid.d.ts +17 -0
- package/dist/clio/scandroid.d.ts.map +1 -0
- package/dist/clio/scandroid.js +435 -0
- package/dist/clio/scansion.d.ts +46 -0
- package/dist/clio/scansion.d.ts.map +1 -0
- package/dist/clio/scansion.js +1086 -0
- package/dist/clio/semantics.d.ts +44 -0
- package/dist/clio/semantics.d.ts.map +1 -0
- package/dist/clio/semantics.js +139 -0
- package/dist/clio/stress.d.ts +83 -0
- package/dist/clio/stress.d.ts.map +1 -0
- package/dist/clio/stress.js +1737 -0
- package/dist/clio/tagfix.d.ts +6 -0
- package/dist/clio/tagfix.d.ts.map +1 -0
- package/dist/clio/tagfix.js +101 -0
- package/dist/display.d.ts +0 -6
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +322 -141
- package/dist/engine.d.ts +9 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +12 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +169 -26
- package/dist/parser.d.ts +3 -3
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +320 -563
- package/dist/phonological.d.ts +1 -1
- package/dist/phonological.d.ts.map +1 -1
- package/dist/phonological.js +73 -4
- package/dist/phrasestress.d.ts +6 -0
- package/dist/phrasestress.d.ts.map +1 -0
- package/dist/phrasestress.js +106 -0
- package/dist/rhyme.d.ts +40 -1
- package/dist/rhyme.d.ts.map +1 -1
- package/dist/rhyme.js +435 -7
- package/dist/scansion.d.ts +9 -0
- package/dist/scansion.d.ts.map +1 -1
- package/dist/scansion.js +145 -18
- package/dist/semantics.d.ts +44 -0
- package/dist/semantics.d.ts.map +1 -0
- package/dist/semantics.js +139 -0
- package/dist/stress.d.ts +127 -4
- package/dist/stress.d.ts.map +1 -1
- package/dist/stress.js +834 -61
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/caesura.ts +201 -0
- package/src/calliope/boundaries.ts +190 -0
- package/src/calliope/bracketing.ts +390 -0
- package/src/calliope/deps.ts +160 -0
- package/src/calliope/engine.ts +77 -0
- package/src/calliope/feats.ts +46 -0
- package/src/calliope/names.ts +44 -0
- package/src/calliope/postag.ts +253 -0
- package/src/calliope/prosodic.ts +262 -0
- package/src/calliope/relstress.ts +645 -0
- package/src/calliope/stressrules.ts +147 -0
- package/src/calliope/syntax.ts +218 -0
- package/src/calliope/udpos.ts +152 -0
- package/src/clio/caesura.ts +145 -0
- package/src/clio/depfix.ts +88 -0
- package/src/clio/display.ts +1042 -0
- package/src/clio/engine.ts +38 -0
- package/src/clio/parser.ts +845 -0
- package/src/clio/phonological.ts +849 -0
- package/src/clio/phrasestress.ts +108 -0
- package/src/clio/pipeline.ts +154 -0
- package/src/clio/rhyme.ts +740 -0
- package/src/clio/scandroid.ts +434 -0
- package/src/clio/scansion.ts +1130 -0
- package/src/clio/semantics.ts +134 -0
- package/src/clio/stress.ts +1731 -0
- package/src/clio/tagfix.ts +104 -0
- package/src/display.ts +321 -137
- package/src/engine.ts +22 -0
- package/src/index.ts +176 -32
- package/src/parser.ts +346 -682
- package/src/phonological.ts +72 -4
- package/src/phrasestress.ts +108 -0
- package/src/rhyme.ts +428 -8
- package/src/scansion.ts +136 -15
- package/src/semantics.ts +134 -0
- package/src/stress.ts +794 -64
- package/src/types.ts +39 -4
- package/tests/DataForHayesLinesOnly.txt +364 -0
- package/tests/DataForHayesStressSymbolsRevised.txt +728 -0
- package/tests/basic.test.ts +443 -37
- package/tests/bench-hayes.mjs +72 -0
- package/tests/wagner-stress.test.ts +188 -0
- package/vitest.config.ts +0 -15
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ClsWord } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A STRANDED preposition: an IN preposition whose complement has been extracted
|
|
4
|
+
* (wh-movement / relativisation / topicalisation), so it governs no object and
|
|
5
|
+
* sits clause-finally — "what are you waiting FOR", "…what you stare AT". Such
|
|
6
|
+
* a preposition bears stress (it is not the reducible proclitic of "in the
|
|
7
|
+
* house"). Conservative: IN only (infinitival TO is excluded — "I want to go"
|
|
8
|
+
* is not stranding), no dependent, and clause-final (the canonical strand site).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isStrandedPreposition(word: ClsWord, words: ClsWord[]): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A CONTRASTIVE possessive: a possessive determiner (PRP$: thy/my/your/her…)
|
|
13
|
+
* in the elliptical contrast frame "X's … not/but MINE" — the contrast lifts
|
|
14
|
+
* the possessor out of reduction ("it was THY choice, not mine"). Tight by
|
|
15
|
+
* construction: requires a contrast marker (not/but/nor) adjacent to an
|
|
16
|
+
* absolute possessive somewhere in the clause, so an ordinary unfocused
|
|
17
|
+
* possessive ("I lost my way") is left alone.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isContrastivePossessive(word: ClsWord, words: ClsWord[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A fronted DEICTIC LOCATIVE "there"/"here" in locative inversion — "THERE
|
|
22
|
+
* could I marvel", "HERE could I rest". FinNLP mis-tags the fronted locative
|
|
23
|
+
* as existential (EX / expl) or reduces it as a discourse adverb, flattening it
|
|
24
|
+
* to 'w'; but a fronted locative that triggers subject-aux inversion (an
|
|
25
|
+
* aux/modal immediately followed by a subject pronoun) is a stressed deictic
|
|
26
|
+
* focus, NOT the reduced existential of "there IS a house" (no inversion) or
|
|
27
|
+
* the presentational "there LIVED a king" (verb + NP, no inversion).
|
|
28
|
+
*/
|
|
29
|
+
export declare function isDeicticLocative(word: ClsWord, words: ClsWord[]): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Imperative clause: the ROOT is a base-form verb (VB) with no overt subject
|
|
32
|
+
* (no NSUBJ dependent) — "Tell me…", "Do not go…". Used by the nuclear pass:
|
|
33
|
+
* the accent falls on the verb / its object, not on a (dropped) subject, and an
|
|
34
|
+
* imperative-clause vocative is a direct address.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isImperativeClause(words: ClsWord[]): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* A VOCATIVE (direct address): a noun tagged DISCOURSE/INTJ/DEP and set off by
|
|
39
|
+
* adjacent punctuation (a comma or "!"), in a clause that is imperative or
|
|
40
|
+
* subject-less — "Sing, O GODDESS…", "blow, BUGLE, blow". Conservative: the
|
|
41
|
+
* noun must be comma/!-adjacent so an ordinary argument noun is not swept in.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isVocative(word: ClsWord, words: ClsWord[]): boolean;
|
|
44
|
+
//# sourceMappingURL=semantics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantics.d.ts","sourceRoot":"","sources":["../../src/clio/semantics.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAsBtC;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAI9E;AAQD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAQhF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAc1E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAS5D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAUnE"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// semantics.ts — Prominence signals mined from the dependency parse + POS.
|
|
2
|
+
//
|
|
3
|
+
// Dependency roles ARE the semantic layer: NSUBJ=agent, DOBJ/IOBJ=patient/
|
|
4
|
+
// recipient, OBL/ADVMOD/ADVCL=peripheral, PRP$=possessor, INTJ/DISCOURSE=
|
|
5
|
+
// address. A flat POS floor crushes function words that these configurations
|
|
6
|
+
// reveal to be prominent — a STRANDED preposition ("what are you waiting FOR"),
|
|
7
|
+
// a CONTRASTIVE possessive ("thy choice, not mine"), a VOCATIVE. These
|
|
8
|
+
// detectors recover that prominence from observable structure only (no semantic
|
|
9
|
+
// guessing, no cross-poem givenness). They are consumed by the relativiser
|
|
10
|
+
// (stress.ts) as targeted floor RAISES, and by the nuclear pass (Phase 4).
|
|
11
|
+
import { isPunctuation } from './parser.js';
|
|
12
|
+
/** True if some other token has `word` as its dependency governor (i.e. word
|
|
13
|
+
* has a complement/dependent of its own). */
|
|
14
|
+
function hasDependent(word, words) {
|
|
15
|
+
for (const w of words) {
|
|
16
|
+
if (w !== word && w.dependency && w.dependency.governor === word)
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
/** Last non-punctuation token index in the sentence at/after `from`? */
|
|
22
|
+
function isClauseFinal(word, words) {
|
|
23
|
+
const idx = words.indexOf(word);
|
|
24
|
+
if (idx < 0)
|
|
25
|
+
return false;
|
|
26
|
+
for (let k = idx + 1; k < words.length; k++) {
|
|
27
|
+
if (!isPunctuation(words[k].lexicalClass))
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A STRANDED preposition: an IN preposition whose complement has been extracted
|
|
34
|
+
* (wh-movement / relativisation / topicalisation), so it governs no object and
|
|
35
|
+
* sits clause-finally — "what are you waiting FOR", "…what you stare AT". Such
|
|
36
|
+
* a preposition bears stress (it is not the reducible proclitic of "in the
|
|
37
|
+
* house"). Conservative: IN only (infinitival TO is excluded — "I want to go"
|
|
38
|
+
* is not stranding), no dependent, and clause-final (the canonical strand site).
|
|
39
|
+
*/
|
|
40
|
+
export function isStrandedPreposition(word, words) {
|
|
41
|
+
if (word.lexicalClass !== 'IN')
|
|
42
|
+
return false;
|
|
43
|
+
if (hasDependent(word, words))
|
|
44
|
+
return false; // has a complement → ordinary preposition
|
|
45
|
+
return isClauseFinal(word, words);
|
|
46
|
+
}
|
|
47
|
+
/** Absolute / elliptical possessive pronouns used as the contrasted element. */
|
|
48
|
+
const ABSOLUTE_POSSESSIVES = new Set([
|
|
49
|
+
'mine', 'thine', 'yours', 'hers', 'ours', 'theirs', 'his',
|
|
50
|
+
]);
|
|
51
|
+
const CONTRAST_MARKERS = new Set(['not', 'but', 'nor']);
|
|
52
|
+
/**
|
|
53
|
+
* A CONTRASTIVE possessive: a possessive determiner (PRP$: thy/my/your/her…)
|
|
54
|
+
* in the elliptical contrast frame "X's … not/but MINE" — the contrast lifts
|
|
55
|
+
* the possessor out of reduction ("it was THY choice, not mine"). Tight by
|
|
56
|
+
* construction: requires a contrast marker (not/but/nor) adjacent to an
|
|
57
|
+
* absolute possessive somewhere in the clause, so an ordinary unfocused
|
|
58
|
+
* possessive ("I lost my way") is left alone.
|
|
59
|
+
*/
|
|
60
|
+
export function isContrastivePossessive(word, words) {
|
|
61
|
+
if (word.lexicalClass !== 'PRP$')
|
|
62
|
+
return false;
|
|
63
|
+
for (let i = 0; i + 1 < words.length; i++) {
|
|
64
|
+
const a = words[i].word.toLowerCase();
|
|
65
|
+
const b = words[i + 1].word.toLowerCase().replace(/['’]/g, '');
|
|
66
|
+
if (CONTRAST_MARKERS.has(a) && ABSOLUTE_POSSESSIVES.has(b))
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
/** Finite auxiliaries / modals whose appearance before a subject pronoun marks
|
|
72
|
+
* subject-aux inversion. */
|
|
73
|
+
const INVERSION_AUX = new Set(['MD', 'VBP', 'VBZ', 'VBD']);
|
|
74
|
+
/**
|
|
75
|
+
* A fronted DEICTIC LOCATIVE "there"/"here" in locative inversion — "THERE
|
|
76
|
+
* could I marvel", "HERE could I rest". FinNLP mis-tags the fronted locative
|
|
77
|
+
* as existential (EX / expl) or reduces it as a discourse adverb, flattening it
|
|
78
|
+
* to 'w'; but a fronted locative that triggers subject-aux inversion (an
|
|
79
|
+
* aux/modal immediately followed by a subject pronoun) is a stressed deictic
|
|
80
|
+
* focus, NOT the reduced existential of "there IS a house" (no inversion) or
|
|
81
|
+
* the presentational "there LIVED a king" (verb + NP, no inversion).
|
|
82
|
+
*/
|
|
83
|
+
export function isDeicticLocative(word, words) {
|
|
84
|
+
const lemma = word.word.toLowerCase().replace(/['’]/g, '');
|
|
85
|
+
if (lemma !== 'there' && lemma !== 'here')
|
|
86
|
+
return false;
|
|
87
|
+
const idx = words.indexOf(word);
|
|
88
|
+
// must be the first non-punctuation token (fronted)
|
|
89
|
+
let first = -1;
|
|
90
|
+
for (let i = 0; i < words.length; i++) {
|
|
91
|
+
if (!isPunctuation(words[i].lexicalClass)) {
|
|
92
|
+
first = i;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (idx !== first)
|
|
97
|
+
return false;
|
|
98
|
+
// subject-aux inversion: <there/here> <aux|modal> <subject pronoun>
|
|
99
|
+
const aux = words[idx + 1];
|
|
100
|
+
const subj = words[idx + 2];
|
|
101
|
+
return !!(aux && subj && INVERSION_AUX.has(aux.lexicalClass) && subj.lexicalClass === 'PRP');
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Imperative clause: the ROOT is a base-form verb (VB) with no overt subject
|
|
105
|
+
* (no NSUBJ dependent) — "Tell me…", "Do not go…". Used by the nuclear pass:
|
|
106
|
+
* the accent falls on the verb / its object, not on a (dropped) subject, and an
|
|
107
|
+
* imperative-clause vocative is a direct address.
|
|
108
|
+
*/
|
|
109
|
+
export function isImperativeClause(words) {
|
|
110
|
+
const root = words.find(w => w.dependency && w.dependency.dependentType === 'root');
|
|
111
|
+
if (!root)
|
|
112
|
+
return false;
|
|
113
|
+
if (root.lexicalClass !== 'VB' && root.lexicalClass !== 'VBP')
|
|
114
|
+
return false;
|
|
115
|
+
for (const w of words) {
|
|
116
|
+
if (w.dependency && w.dependency.governor === root
|
|
117
|
+
&& /nsubj/i.test(w.dependency.dependentType))
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A VOCATIVE (direct address): a noun tagged DISCOURSE/INTJ/DEP and set off by
|
|
124
|
+
* adjacent punctuation (a comma or "!"), in a clause that is imperative or
|
|
125
|
+
* subject-less — "Sing, O GODDESS…", "blow, BUGLE, blow". Conservative: the
|
|
126
|
+
* noun must be comma/!-adjacent so an ordinary argument noun is not swept in.
|
|
127
|
+
*/
|
|
128
|
+
export function isVocative(word, words) {
|
|
129
|
+
if (!/^(NN|NNS|NNP|NNPS)$/.test(word.lexicalClass))
|
|
130
|
+
return false;
|
|
131
|
+
const role = word.dependency?.dependentType ?? '';
|
|
132
|
+
if (!/discourse|intj|dep|vocative/i.test(role))
|
|
133
|
+
return false;
|
|
134
|
+
const idx = words.indexOf(word);
|
|
135
|
+
const prev = idx > 0 ? words[idx - 1] : null;
|
|
136
|
+
const next = idx + 1 < words.length ? words[idx + 1] : null;
|
|
137
|
+
const commaAdjacent = (prev && /^[,!]$/.test(prev.word)) || (next && /^[,!]$/.test(next.word));
|
|
138
|
+
return !!commaAdjacent && isImperativeClause(words);
|
|
139
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ClsWord, IntonationalUnit } from '../types.js';
|
|
2
|
+
/** Check if a pair of words forms a left‑stressed compound. */
|
|
3
|
+
export declare function isLeftStressedPair(w1: string, w2: string): boolean;
|
|
4
|
+
/** True if `w2` is a head noun that keeps phrasal/right stress against an N1
|
|
5
|
+
* modifier (apple PIE, summer DAY, Fifth AVenue) — the marked right-stress
|
|
6
|
+
* exceptions to the otherwise fore-stressing Compound Stress Rule. */
|
|
7
|
+
export declare function isRightStressedHead(w2: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Direction of primary stress for an adjacent two-word modification structure,
|
|
10
|
+
* the SINGLE source of truth shared by the lexical compound pass
|
|
11
|
+
* (`applyCompoundStress`) and the Phrase-Stress phase (`computePhraseStress`),
|
|
12
|
+
* so the two layers cannot disagree.
|
|
13
|
+
*
|
|
14
|
+
* 'left' = fore-stress, primary on w1 — the Compound Stress Rule default for
|
|
15
|
+
* an N+N compound (Chomsky–Halle; McAleese's worked example marks
|
|
16
|
+
* ICE cream with primary on "ice", not "cream"): KITCHen table,
|
|
17
|
+
* WINdow frame, BEDroom door, plus the curated LEFT_STRESS_* sets.
|
|
18
|
+
* 'right' = end-stress, primary on w2 — the marked exceptions: food/temporal
|
|
19
|
+
* "made of N1" heads (apple PIE, summer DAY), Adj+N which is phrasal
|
|
20
|
+
* not compound (sweet CREAM, red CAR), and proper-name sequences
|
|
21
|
+
* which carry their own right-headed prosody (New YORK, John SMITH).
|
|
22
|
+
* null = not a compound/modification pair at all.
|
|
23
|
+
*
|
|
24
|
+
* The fore-stress default is restricted to COMMON-noun N+N: proper-noun pairs
|
|
25
|
+
* (NNP/NNPS) are excluded because place- and personal-name sequences are not
|
|
26
|
+
* reliably fore-stressed, and flipping them would mis-teach New YORK / John SMITH.
|
|
27
|
+
*/
|
|
28
|
+
export declare function compoundStressSide(w1: string, pos1: string, w2: string, pos2: string): 'left' | 'right' | null;
|
|
29
|
+
/**
|
|
30
|
+
* Assign per‑syllable lexical stress to each word in a sentence.
|
|
31
|
+
*
|
|
32
|
+
* Uses the first CMU pronunciation. Function words have their
|
|
33
|
+
* primary stress downgraded to secondary (2 → 1).
|
|
34
|
+
*/
|
|
35
|
+
export declare function assignLexicalStress(words: ClsWord[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Adjust stresses for nominal compounds.
|
|
38
|
+
*
|
|
39
|
+
* Fore-stressed by default: an N+N compound puts primary (2) on the first
|
|
40
|
+
* element, secondary (1) on the second — the Compound Stress Rule (Chomsky–
|
|
41
|
+
* Halle; McAleese marks ICE cream with primary on "ice", KITCHen table,
|
|
42
|
+
* WINdow frame). The marked right-stress exceptions — food/temporal "made of"
|
|
43
|
+
* heads (apple PIE), Adj+N phrases (sweet CREAM), and proper-name sequences
|
|
44
|
+
* (New YORK) — reverse it. All of this lives in `compoundStressSide`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function applyCompoundStress(ius: IntonationalUnit[]): void;
|
|
47
|
+
/** Locate the syllable with the highest stress and set it to `value`. */
|
|
48
|
+
export declare function setPrimaryStress(word: ClsWord, value: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Recursively assign higher stress to content words from right to left.
|
|
51
|
+
* Only the rightmost content word receives a boost (+1 above lexical primary).
|
|
52
|
+
* All other content words keep their lexical stress.
|
|
53
|
+
* This preserves lexical stress for meter detection while still indicating
|
|
54
|
+
* the nuclear accent for phonological phrasing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyNuclearStress(ius: IntonationalUnit[]): void;
|
|
57
|
+
/**
|
|
58
|
+
* Convert numeric per‑syllable stress to McAleese’s symbolic levels
|
|
59
|
+
* (w, n, m, s) and resolve adjacent identical stresses using dependency
|
|
60
|
+
* information.
|
|
61
|
+
*/
|
|
62
|
+
export declare function assignRelativeStresses(words: ClsWord[], ius: IntonationalUnit[]): void;
|
|
63
|
+
/**
|
|
64
|
+
* THE CLASH FILTER — an absolute surface well-formedness constraint.
|
|
65
|
+
*
|
|
66
|
+
* On the STRESSED tier {n, m, s} no two *contiguous* syllables may carry the SAME
|
|
67
|
+
* level: that is a stress clash (two equal prominences with no gradation between
|
|
68
|
+
* them), which English categorically disallows. Gradient pairs (sm/ms/sn/ns/mn/nm)
|
|
69
|
+
* are fine — there is still a step down — as are runs of the unstressed tiers
|
|
70
|
+
* {w, x} (an unstressed sequence is tolerated, if not ideal). This generalises
|
|
71
|
+
* McAleese's Appendix-A step 3d-ii ("stress clashes (ss, ms) > s-s") and Liberman
|
|
72
|
+
* & Prince's (1977) grid alternation to every level of the strong tier.
|
|
73
|
+
*
|
|
74
|
+
* Resolution is DEMOTE-ONLY (never promote — promotion is the meter layer's job,
|
|
75
|
+
* McAleese Test 2), so the contour is never inflated to break a clash; we iterate
|
|
76
|
+
* to a fixed point (each change strictly lowers total stress mass, so it
|
|
77
|
+
* terminates). Which member yields is decided by `demoteRightOfClash` (grid-based
|
|
78
|
+
* relative prominence). Runs on the LINEAR surface order because a clash is a
|
|
79
|
+
* property of contiguous *pronounced* syllables (Hayes), which a mis-grouped
|
|
80
|
+
* dependency parse can scatter across phrases.
|
|
81
|
+
*/
|
|
82
|
+
export declare function resolveLinearClashes(words: ClsWord[]): void;
|
|
83
|
+
//# sourceMappingURL=stress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stress.d.ts","sourceRoot":"","sources":["../../src/clio/stress.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAyB,gBAAgB,EAAsB,MAAM,aAAa,CAAC;AA2VnG,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAelE;AAED;;uEAEuE;AACvE,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GACjD,MAAM,GAAG,OAAO,GAAG,IAAI,CASzB;AAiSD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAkR1D;AAID;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CA2BjE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAYnE;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAwChE;AA8CD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAsLtF;AA8FD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAuB3D"}
|