@vocasync/astro 0.1.10 → 1.0.1
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 +77 -41
- package/dist/api/client.d.ts +63 -50
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +132 -145
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/components/AudioPlayer.astro +141 -137
- package/dist/config/schema.d.ts +21 -20
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +15 -4
- package/dist/config/schema.js.map +1 -1
- package/dist/core/audio-map.js +1 -1
- package/dist/core/speech-builder.d.ts +10 -7
- package/dist/core/speech-builder.d.ts.map +1 -1
- package/dist/core/speech-builder.js +72 -116
- package/dist/core/speech-builder.js.map +1 -1
- package/dist/core/spoken-form.d.ts +52 -0
- package/dist/core/spoken-form.d.ts.map +1 -0
- package/dist/core/spoken-form.js +279 -0
- package/dist/core/spoken-form.js.map +1 -0
- package/dist/lib/latex-to-speech/index.d.ts.map +1 -1
- package/dist/lib/latex-to-speech/index.js +9 -11
- package/dist/lib/latex-to-speech/index.js.map +1 -1
- package/dist/lib/latex-to-speech/speak.d.ts +7 -2
- package/dist/lib/latex-to-speech/speak.d.ts.map +1 -1
- package/dist/lib/latex-to-speech/speak.js +10 -27
- package/dist/lib/latex-to-speech/speak.js.map +1 -1
- package/dist/rehype/audio-words.d.ts +14 -24
- package/dist/rehype/audio-words.d.ts.map +1 -1
- package/dist/rehype/audio-words.js +131 -252
- package/dist/rehype/audio-words.js.map +1 -1
- package/dist/rehype/index.d.ts +1 -2
- package/dist/rehype/index.d.ts.map +1 -1
- package/dist/rehype/index.js +0 -1
- package/dist/rehype/index.js.map +1 -1
- package/dist/rehype/rehype-math-speech.d.ts +26 -10
- package/dist/rehype/rehype-math-speech.d.ts.map +1 -1
- package/dist/rehype/rehype-math-speech.js +59 -43
- package/dist/rehype/rehype-math-speech.js.map +1 -1
- package/dist/rehype/shared.d.ts +9 -0
- package/dist/rehype/shared.d.ts.map +1 -0
- package/dist/rehype/shared.js +31 -0
- package/dist/rehype/shared.js.map +1 -0
- package/dist/sync/orchestrator.d.ts +4 -22
- package/dist/sync/orchestrator.d.ts.map +1 -1
- package/dist/sync/orchestrator.js +123 -123
- package/dist/sync/orchestrator.js.map +1 -1
- package/dist/types/index.d.ts +82 -46
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/api/client.ts +175 -190
- package/src/api/index.ts +8 -1
- package/src/cli.ts +7 -14
- package/src/components/AudioPlayer.astro +141 -137
- package/src/config/schema.ts +15 -4
- package/src/core/audio-map.ts +1 -1
- package/src/core/speech-builder.ts +74 -130
- package/src/core/spoken-form.ts +298 -0
- package/src/lib/latex-to-speech/index.ts +8 -9
- package/src/lib/latex-to-speech/speak.ts +11 -34
- package/src/rehype/audio-words.ts +145 -307
- package/src/rehype/index.ts +1 -2
- package/src/rehype/rehype-math-speech.ts +64 -59
- package/src/rehype/shared.ts +36 -0
- package/src/sync/orchestrator.ts +150 -157
- package/src/types/index.ts +85 -47
- package/dist/rehype/remark-math-speech.d.ts +0 -14
- package/dist/rehype/remark-math-speech.d.ts.map +0 -1
- package/dist/rehype/remark-math-speech.js +0 -27
- package/dist/rehype/remark-math-speech.js.map +0 -1
- package/src/rehype/remark-math-speech.ts +0 -32
|
@@ -2,154 +2,114 @@ import remarkMath from "remark-math";
|
|
|
2
2
|
import remarkParse from "remark-parse";
|
|
3
3
|
import { unified } from "unified";
|
|
4
4
|
import { speakLatex } from "../lib/latex-to-speech/speak.js";
|
|
5
|
-
import {
|
|
6
|
-
/**
|
|
7
|
-
* Create a LaTeX converter that delegates to the shared speakLatex module.
|
|
8
|
-
*/
|
|
9
|
-
function createLatexConverter(config) {
|
|
10
|
-
if (!config.enabled) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const style = config.style || "clearspeak";
|
|
14
|
-
return {
|
|
15
|
-
convert(latex, display) {
|
|
16
|
-
return speakLatex(latex, display, style);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
5
|
+
import { buildSpeechtextPair } from "./spoken-form.js";
|
|
20
6
|
/**
|
|
21
7
|
* Build a speech document from markdown content.
|
|
22
|
-
* Converts markdown to plain text suitable for TTS synthesis.
|
|
23
8
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
9
|
+
* Produces plain text from the SAME visible tokens the rehype word-wrapper
|
|
10
|
+
* sees — no phantom tokens (no "Quote:", "Image:", "[Code in X]", inline
|
|
11
|
+
* code), and code blocks / images are skipped exactly as rehype skips
|
|
12
|
+
* `pre`/`code`/`img`. This keeps the alignment transcript
|
|
13
|
+
* (`normalisedSpeechtext`) token-for-token with the rehype `data-i` stream.
|
|
14
|
+
*
|
|
15
|
+
* Headings keep a leading "# " marker so the synthesis backend chunks at
|
|
16
|
+
* heading boundaries; `stripForAlignment` removes it, so it never becomes an
|
|
17
|
+
* alignment token. Math expressions contribute their `speakLatex` output at
|
|
18
|
+
* their reading position (the same string the rehype math handler counts).
|
|
27
19
|
*/
|
|
28
20
|
export async function buildSpeechDocument(item, options = {}) {
|
|
29
21
|
const mathConfig = options.math ?? { enabled: false, style: "clearspeak" };
|
|
30
|
-
const
|
|
31
|
-
// Parse markdown with math support
|
|
22
|
+
const style = mathConfig.style || "clearspeak";
|
|
32
23
|
const processor = unified().use(remarkParse).use(remarkMath);
|
|
33
24
|
const tree = processor.parse(item.content);
|
|
34
|
-
// Extract text from AST - can contain strings or promises
|
|
35
25
|
const textParts = [];
|
|
26
|
+
// Collect math spoken forms keyed by `${'d'|'i'}:${latex}` so the rehype
|
|
27
|
+
// plugin can reuse them without running math-to-speech in the Vite build.
|
|
28
|
+
const mathKeys = [];
|
|
29
|
+
const mathPromises = [];
|
|
30
|
+
function recordMath(latex, display) {
|
|
31
|
+
const p = speakLatex(latex, display, style);
|
|
32
|
+
mathKeys.push(`${display ? "d" : "i"}:${latex.trim()}`);
|
|
33
|
+
mathPromises.push(p);
|
|
34
|
+
return p;
|
|
35
|
+
}
|
|
36
|
+
function processChildren(node) {
|
|
37
|
+
for (const child of node.children) {
|
|
38
|
+
processNode(child);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
36
41
|
function processNode(node) {
|
|
37
42
|
switch (node.type) {
|
|
38
43
|
case "text": {
|
|
39
|
-
|
|
40
|
-
textParts.push(textNode.value);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case "inlineCode": {
|
|
44
|
-
const codeNode = node;
|
|
45
|
-
// Skip short code, read longer code
|
|
46
|
-
if (codeNode.value.length > 10) {
|
|
47
|
-
textParts.push(codeNode.value);
|
|
48
|
-
}
|
|
44
|
+
textParts.push(node.value);
|
|
49
45
|
break;
|
|
50
46
|
}
|
|
47
|
+
// Inline code and code blocks are skipped by the rehype word-wrapper
|
|
48
|
+
// (pre/code in its skip set), so they must not contribute speech tokens.
|
|
49
|
+
case "inlineCode":
|
|
51
50
|
case "code": {
|
|
52
|
-
const blockCode = node;
|
|
53
|
-
// Skip code blocks entirely for TTS
|
|
54
|
-
// Could optionally add language hint: "Code block in {lang}"
|
|
55
|
-
if (blockCode.lang) {
|
|
56
|
-
textParts.push(`[Code in ${blockCode.lang}]`);
|
|
57
|
-
}
|
|
58
51
|
break;
|
|
59
52
|
}
|
|
60
53
|
case "heading": {
|
|
61
54
|
const heading = node;
|
|
62
|
-
//
|
|
55
|
+
// Single "#" chunk marker for all heading levels (synthesis backend
|
|
56
|
+
// expects it). Removed by stripForAlignment, so not an alignment token.
|
|
63
57
|
textParts.push("\n# ");
|
|
64
|
-
|
|
65
|
-
for (const child of heading.children) {
|
|
66
|
-
processNode(child);
|
|
67
|
-
}
|
|
68
|
-
// Add newline after headings for separation
|
|
58
|
+
processChildren(heading);
|
|
69
59
|
textParts.push("\n");
|
|
70
60
|
break;
|
|
71
61
|
}
|
|
72
62
|
case "paragraph": {
|
|
73
|
-
|
|
74
|
-
for (const child of para.children) {
|
|
75
|
-
processNode(child);
|
|
76
|
-
}
|
|
77
|
-
// Paragraph break
|
|
63
|
+
processChildren(node);
|
|
78
64
|
textParts.push("\n");
|
|
79
65
|
break;
|
|
80
66
|
}
|
|
81
67
|
case "emphasis": {
|
|
82
|
-
|
|
83
|
-
for (const child of em.children) {
|
|
84
|
-
processNode(child);
|
|
85
|
-
}
|
|
68
|
+
processChildren(node);
|
|
86
69
|
break;
|
|
87
70
|
}
|
|
88
71
|
case "strong": {
|
|
89
|
-
|
|
90
|
-
for (const child of strong.children) {
|
|
91
|
-
processNode(child);
|
|
92
|
-
}
|
|
72
|
+
processChildren(node);
|
|
93
73
|
break;
|
|
94
74
|
}
|
|
95
75
|
case "link": {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
for (const child of link.children) {
|
|
99
|
-
processNode(child);
|
|
100
|
-
}
|
|
76
|
+
// Read link text only, not the URL (matches rehype: <a> text is walked).
|
|
77
|
+
processChildren(node);
|
|
101
78
|
break;
|
|
102
79
|
}
|
|
80
|
+
// Images are skipped by the rehype word-wrapper (img in its skip set);
|
|
81
|
+
// alt text is an attribute, not a rendered text node — emit nothing.
|
|
103
82
|
case "image": {
|
|
104
|
-
const img = node;
|
|
105
|
-
// Read alt text
|
|
106
|
-
if (img.alt) {
|
|
107
|
-
textParts.push(`Image: ${img.alt}`);
|
|
108
|
-
}
|
|
109
83
|
break;
|
|
110
84
|
}
|
|
111
85
|
case "list": {
|
|
112
|
-
|
|
113
|
-
for (const child of list.children) {
|
|
114
|
-
processNode(child);
|
|
115
|
-
}
|
|
86
|
+
processChildren(node);
|
|
116
87
|
break;
|
|
117
88
|
}
|
|
118
89
|
case "listItem": {
|
|
119
|
-
|
|
120
|
-
for
|
|
121
|
-
processNode(child);
|
|
122
|
-
}
|
|
90
|
+
processChildren(node);
|
|
91
|
+
// Sentence break for TTS prosody; punctuation only, not an alignment token.
|
|
123
92
|
textParts.push(". ");
|
|
124
93
|
break;
|
|
125
94
|
}
|
|
126
95
|
case "blockquote": {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
textParts.push(" End quote.");
|
|
96
|
+
// Just the quote's text — no "Quote:"/"End quote." wrappers (those
|
|
97
|
+
// words have no rendered-DOM counterpart and would desync data-i).
|
|
98
|
+
processChildren(node);
|
|
99
|
+
textParts.push("\n");
|
|
133
100
|
break;
|
|
134
101
|
}
|
|
135
|
-
// Math nodes from remark-math
|
|
136
102
|
case "math": {
|
|
137
103
|
const mathNode = node;
|
|
138
|
-
if (
|
|
139
|
-
textParts.push(
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
textParts.push(`[Math: ${mathNode.value.slice(0, 30)}]`);
|
|
104
|
+
if (mathConfig.enabled) {
|
|
105
|
+
textParts.push(recordMath(mathNode.value, true));
|
|
143
106
|
}
|
|
144
107
|
break;
|
|
145
108
|
}
|
|
146
109
|
case "inlineMath": {
|
|
147
110
|
const inlineMathNode = node;
|
|
148
|
-
if (
|
|
149
|
-
textParts.push(
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
textParts.push(inlineMathNode.value);
|
|
111
|
+
if (mathConfig.enabled) {
|
|
112
|
+
textParts.push(recordMath(inlineMathNode.value, false));
|
|
153
113
|
}
|
|
154
114
|
break;
|
|
155
115
|
}
|
|
@@ -157,44 +117,40 @@ export async function buildSpeechDocument(item, options = {}) {
|
|
|
157
117
|
textParts.push("\n\n");
|
|
158
118
|
break;
|
|
159
119
|
}
|
|
160
|
-
// Handle container nodes with children
|
|
161
120
|
case "root": {
|
|
162
|
-
|
|
163
|
-
for (const child of root.children) {
|
|
164
|
-
processNode(child);
|
|
165
|
-
}
|
|
121
|
+
processChildren(node);
|
|
166
122
|
break;
|
|
167
123
|
}
|
|
168
124
|
default: {
|
|
169
|
-
// Try to process children if they exist
|
|
170
125
|
const maybeParent = node;
|
|
171
|
-
if (maybeParent.children)
|
|
172
|
-
|
|
173
|
-
processNode(child);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
126
|
+
if (maybeParent.children)
|
|
127
|
+
processChildren(maybeParent);
|
|
176
128
|
}
|
|
177
129
|
}
|
|
178
130
|
}
|
|
179
131
|
processNode(tree);
|
|
180
|
-
// Resolve
|
|
132
|
+
// Resolve async math conversions.
|
|
181
133
|
const resolvedParts = await Promise.all(textParts);
|
|
182
|
-
//
|
|
183
|
-
|
|
134
|
+
// Normalize whitespace. The title is intentionally excluded so the
|
|
135
|
+
// alignment data matches the article body only.
|
|
136
|
+
const plainText = resolvedParts
|
|
184
137
|
.join(" ")
|
|
185
|
-
.replace(
|
|
186
|
-
.replace(/\n\s*\n/g, "\n\n")
|
|
187
|
-
.replace(/\s*\.\s*\./g, ".")
|
|
138
|
+
.replace(/[ \t]+/g, " ")
|
|
139
|
+
.replace(/\n\s*\n/g, "\n\n")
|
|
140
|
+
.replace(/\s*\.\s*\./g, ".")
|
|
188
141
|
.trim();
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
142
|
+
const { speechtext, normalisedSpeechtext } = buildSpeechtextPair(plainText);
|
|
143
|
+
// Map each math expression's latex key to its resolved spoken form.
|
|
144
|
+
const resolvedMath = await Promise.all(mathPromises);
|
|
145
|
+
const mathSpeech = {};
|
|
146
|
+
for (let i = 0; i < mathKeys.length; i++) {
|
|
147
|
+
mathSpeech[mathKeys[i]] = resolvedMath[i];
|
|
148
|
+
}
|
|
194
149
|
return {
|
|
195
150
|
slug: item.slug,
|
|
196
|
-
|
|
197
|
-
|
|
151
|
+
speechtext,
|
|
152
|
+
normalisedSpeechtext,
|
|
153
|
+
mathSpeech,
|
|
198
154
|
source: item.filePath,
|
|
199
155
|
};
|
|
200
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speech-builder.js","sourceRoot":"","sources":["../../src/core/speech-builder.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"speech-builder.js","sourceRoot":"","sources":["../../src/core/speech-builder.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAiB,EACjB,UAAwB,EAAE;IAE1B,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,YAAY,CAAC;IAE/C,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAS,CAAC;IAEnD,MAAM,SAAS,GAAiC,EAAE,CAAC;IACnD,yEAAyE;IACzE,0EAA0E;IAC1E,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,YAAY,GAAsB,EAAE,CAAC;IAE3C,SAAS,UAAU,CAAC,KAAa,EAAE,OAAgB;QACjD,MAAM,CAAC,G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;QACpB,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,QAAQ;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spoken-form normalization primitives.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the Valeon blog's audio pipeline so the plugin's
|
|
5
|
+
* build-time tokenization reproduces VocaSync's alignment token stream
|
|
6
|
+
* exactly. Two transforms:
|
|
7
|
+
*
|
|
8
|
+
* expandSpokenForms(text) — expands currencies, numbers, percentages
|
|
9
|
+
* into spoken word equivalents. Preserves
|
|
10
|
+
* punctuation/casing so it reads naturally
|
|
11
|
+
* for TTS. This is the `speechtext` POSTed
|
|
12
|
+
* to synthesis.
|
|
13
|
+
*
|
|
14
|
+
* stripForAlignment(text) — derives the alignment-friendly form:
|
|
15
|
+
* lowercase, punctuation removed, whitespace
|
|
16
|
+
* collapsed, contractions preserved. This is
|
|
17
|
+
* the `normalisedSpeechtext` POSTed as the
|
|
18
|
+
* alignment transcript AND the basis for the
|
|
19
|
+
* rehype plugin's `data-i`/`data-n` indices.
|
|
20
|
+
*
|
|
21
|
+
* Because the alignment transcript IS `stripForAlignment(expandSpokenForms(text))`,
|
|
22
|
+
* the worker's own normalizer is a no-op over it and word indices line up
|
|
23
|
+
* token-for-token with the rehype output.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Expand currency symbols, numbers, and percentages into their spoken
|
|
27
|
+
* word forms. Preserves punctuation and surrounding text — this is the
|
|
28
|
+
* surface that becomes `speechtext`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function expandSpokenForms(input: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Strip a speechtext-form string into the alignment form: lowercase,
|
|
33
|
+
* punctuation removed, whitespace collapsed. Contractions are preserved
|
|
34
|
+
* (e.g. "don't" stays one token).
|
|
35
|
+
*/
|
|
36
|
+
export declare function stripForAlignment(input: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Produce both the speechtext (POSTed to synthesis) and
|
|
39
|
+
* normalisedSpeechtext (POSTed as the alignment transcript) forms from a
|
|
40
|
+
* single plain-text input.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildSpeechtextPair(plainText: string): {
|
|
43
|
+
speechtext: string;
|
|
44
|
+
normalisedSpeechtext: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* How many alignment tokens a visible string expands to. Used by the
|
|
48
|
+
* rehype plugin to compute `data-n` for each wrapped word / math unit.
|
|
49
|
+
* "$50" -> 2 ("fifty dollar"); "1995" -> 6; unambiguous words -> 1.
|
|
50
|
+
*/
|
|
51
|
+
export declare function spokenTokenCount(visible: string): number;
|
|
52
|
+
//# sourceMappingURL=spoken-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spoken-form.d.ts","sourceRoot":"","sources":["../../src/core/spoken-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA8LH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuCvD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAIA;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIxD"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spoken-form normalization primitives.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the Valeon blog's audio pipeline so the plugin's
|
|
5
|
+
* build-time tokenization reproduces VocaSync's alignment token stream
|
|
6
|
+
* exactly. Two transforms:
|
|
7
|
+
*
|
|
8
|
+
* expandSpokenForms(text) — expands currencies, numbers, percentages
|
|
9
|
+
* into spoken word equivalents. Preserves
|
|
10
|
+
* punctuation/casing so it reads naturally
|
|
11
|
+
* for TTS. This is the `speechtext` POSTed
|
|
12
|
+
* to synthesis.
|
|
13
|
+
*
|
|
14
|
+
* stripForAlignment(text) — derives the alignment-friendly form:
|
|
15
|
+
* lowercase, punctuation removed, whitespace
|
|
16
|
+
* collapsed, contractions preserved. This is
|
|
17
|
+
* the `normalisedSpeechtext` POSTed as the
|
|
18
|
+
* alignment transcript AND the basis for the
|
|
19
|
+
* rehype plugin's `data-i`/`data-n` indices.
|
|
20
|
+
*
|
|
21
|
+
* Because the alignment transcript IS `stripForAlignment(expandSpokenForms(text))`,
|
|
22
|
+
* the worker's own normalizer is a no-op over it and word indices line up
|
|
23
|
+
* token-for-token with the rehype output.
|
|
24
|
+
*/
|
|
25
|
+
const CURRENCY_SYMBOL_WORDS = {
|
|
26
|
+
"£": "pound",
|
|
27
|
+
$: "dollar",
|
|
28
|
+
"€": "euro",
|
|
29
|
+
"¥": "yen",
|
|
30
|
+
"₹": "rupee",
|
|
31
|
+
"₽": "ruble",
|
|
32
|
+
"₩": "won",
|
|
33
|
+
"₪": "shekel",
|
|
34
|
+
"₺": "lira",
|
|
35
|
+
"฿": "baht",
|
|
36
|
+
"₫": "dong",
|
|
37
|
+
"₴": "hryvnia",
|
|
38
|
+
"₦": "naira",
|
|
39
|
+
"₱": "peso",
|
|
40
|
+
"₲": "guarani",
|
|
41
|
+
"₡": "colon",
|
|
42
|
+
"₭": "kip",
|
|
43
|
+
"₮": "tugrik",
|
|
44
|
+
"₿": "bitcoin",
|
|
45
|
+
"₣": "franc",
|
|
46
|
+
"¢": "cent",
|
|
47
|
+
"₤": "lira",
|
|
48
|
+
};
|
|
49
|
+
const CURRENCY_SYMBOL_LIST = Object.keys(CURRENCY_SYMBOL_WORDS);
|
|
50
|
+
const CURRENCY_SYMBOL_CLASS = CURRENCY_SYMBOL_LIST.join("");
|
|
51
|
+
const CURRENCY_SYMBOL_RANGE = `[${CURRENCY_SYMBOL_CLASS}]`;
|
|
52
|
+
const CURRENCY_SYMBOL_BEFORE_NUMBER_REGEX = new RegExp(`(${CURRENCY_SYMBOL_RANGE})\\s*([0-9]+(?:[.,][0-9]+)*)`, "gu");
|
|
53
|
+
const CURRENCY_SYMBOL_AFTER_NUMBER_REGEX = new RegExp(`([0-9]+(?:[.,][0-9]+)*)\\s*(${CURRENCY_SYMBOL_RANGE})`, "gu");
|
|
54
|
+
const CURRENCY_SYMBOL_REGEX = new RegExp(CURRENCY_SYMBOL_RANGE, "gu");
|
|
55
|
+
const DIGIT_WORDS = [
|
|
56
|
+
"zero",
|
|
57
|
+
"one",
|
|
58
|
+
"two",
|
|
59
|
+
"three",
|
|
60
|
+
"four",
|
|
61
|
+
"five",
|
|
62
|
+
"six",
|
|
63
|
+
"seven",
|
|
64
|
+
"eight",
|
|
65
|
+
"nine",
|
|
66
|
+
];
|
|
67
|
+
const SMALL_WORDS = [
|
|
68
|
+
"zero",
|
|
69
|
+
"one",
|
|
70
|
+
"two",
|
|
71
|
+
"three",
|
|
72
|
+
"four",
|
|
73
|
+
"five",
|
|
74
|
+
"six",
|
|
75
|
+
"seven",
|
|
76
|
+
"eight",
|
|
77
|
+
"nine",
|
|
78
|
+
"ten",
|
|
79
|
+
"eleven",
|
|
80
|
+
"twelve",
|
|
81
|
+
"thirteen",
|
|
82
|
+
"fourteen",
|
|
83
|
+
"fifteen",
|
|
84
|
+
"sixteen",
|
|
85
|
+
"seventeen",
|
|
86
|
+
"eighteen",
|
|
87
|
+
"nineteen",
|
|
88
|
+
];
|
|
89
|
+
const TENS_WORDS = [
|
|
90
|
+
"",
|
|
91
|
+
"",
|
|
92
|
+
"twenty",
|
|
93
|
+
"thirty",
|
|
94
|
+
"forty",
|
|
95
|
+
"fifty",
|
|
96
|
+
"sixty",
|
|
97
|
+
"seventy",
|
|
98
|
+
"eighty",
|
|
99
|
+
"ninety",
|
|
100
|
+
];
|
|
101
|
+
const SCALE_WORDS = [
|
|
102
|
+
"",
|
|
103
|
+
"thousand",
|
|
104
|
+
"million",
|
|
105
|
+
"billion",
|
|
106
|
+
"trillion",
|
|
107
|
+
"quadrillion",
|
|
108
|
+
"quintillion",
|
|
109
|
+
"sextillion",
|
|
110
|
+
];
|
|
111
|
+
function threeDigitWords(value) {
|
|
112
|
+
const parts = [];
|
|
113
|
+
let v = value;
|
|
114
|
+
if (v >= 100) {
|
|
115
|
+
parts.push(SMALL_WORDS[Math.floor(v / 100)]);
|
|
116
|
+
parts.push("hundred");
|
|
117
|
+
v %= 100;
|
|
118
|
+
}
|
|
119
|
+
if (v >= 20) {
|
|
120
|
+
parts.push(TENS_WORDS[Math.floor(v / 10)]);
|
|
121
|
+
v %= 10;
|
|
122
|
+
if (v > 0)
|
|
123
|
+
parts.push(SMALL_WORDS[v]);
|
|
124
|
+
}
|
|
125
|
+
else if (v > 0 || parts.length === 0) {
|
|
126
|
+
parts.push(SMALL_WORDS[v]);
|
|
127
|
+
}
|
|
128
|
+
return parts.join(" ").trim();
|
|
129
|
+
}
|
|
130
|
+
const BIG_ZERO = BigInt(0);
|
|
131
|
+
const BIG_THOUSAND = BigInt(1000);
|
|
132
|
+
function integerToWords(value) {
|
|
133
|
+
if (value === BIG_ZERO)
|
|
134
|
+
return "zero";
|
|
135
|
+
const parts = [];
|
|
136
|
+
let remaining = value;
|
|
137
|
+
let scale = 0;
|
|
138
|
+
while (remaining > BIG_ZERO) {
|
|
139
|
+
const chunk = Number(remaining % BIG_THOUSAND);
|
|
140
|
+
if (chunk > 0) {
|
|
141
|
+
const words = threeDigitWords(chunk);
|
|
142
|
+
const scaleWord = SCALE_WORDS[scale];
|
|
143
|
+
parts.unshift(scaleWord ? `${words} ${scaleWord}`.trim() : words);
|
|
144
|
+
}
|
|
145
|
+
remaining /= BIG_THOUSAND;
|
|
146
|
+
scale += 1;
|
|
147
|
+
}
|
|
148
|
+
return parts.join(" ").trim();
|
|
149
|
+
}
|
|
150
|
+
function expandNumberToken(token) {
|
|
151
|
+
let working = token;
|
|
152
|
+
const result = [];
|
|
153
|
+
let negative = false;
|
|
154
|
+
if (working.startsWith("-")) {
|
|
155
|
+
negative = true;
|
|
156
|
+
working = working.slice(1);
|
|
157
|
+
}
|
|
158
|
+
if (!working)
|
|
159
|
+
working = "0";
|
|
160
|
+
const [intPart, decPart] = working.split(".");
|
|
161
|
+
const integerValue = intPart ? BigInt(intPart) : BIG_ZERO;
|
|
162
|
+
const integerWords = integerToWords(integerValue);
|
|
163
|
+
if (negative)
|
|
164
|
+
result.push("minus");
|
|
165
|
+
result.push(integerWords);
|
|
166
|
+
if (decPart) {
|
|
167
|
+
result.push("point");
|
|
168
|
+
for (const digit of decPart) {
|
|
169
|
+
const value = Number(digit);
|
|
170
|
+
if (!Number.isNaN(value) && value >= 0 && value <= 9) {
|
|
171
|
+
result.push(DIGIT_WORDS[value]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return result.join(" ");
|
|
176
|
+
}
|
|
177
|
+
function expandNumbers(input) {
|
|
178
|
+
return input.replace(/-?\d+(\.\d+)?/g, expandNumberToken);
|
|
179
|
+
}
|
|
180
|
+
function expandCurrencySymbols(input) {
|
|
181
|
+
let text = input.replace(CURRENCY_SYMBOL_BEFORE_NUMBER_REGEX, (_, symbol, digits) => {
|
|
182
|
+
const word = CURRENCY_SYMBOL_WORDS[symbol];
|
|
183
|
+
return word ? `${digits} ${word}` : `${symbol}${digits}`;
|
|
184
|
+
});
|
|
185
|
+
text = text.replace(CURRENCY_SYMBOL_AFTER_NUMBER_REGEX, (_, digits, symbol) => {
|
|
186
|
+
const word = CURRENCY_SYMBOL_WORDS[symbol];
|
|
187
|
+
return word ? `${digits} ${word}` : `${digits}${symbol}`;
|
|
188
|
+
});
|
|
189
|
+
return text.replace(CURRENCY_SYMBOL_REGEX, (symbol) => {
|
|
190
|
+
const word = CURRENCY_SYMBOL_WORDS[symbol];
|
|
191
|
+
return word ? ` ${word} ` : " ";
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function expandPercents(input) {
|
|
195
|
+
// Match number-followed-by-% (with optional space). "50%" -> "50 percent".
|
|
196
|
+
// Runs before number expansion so the digits still parse cleanly.
|
|
197
|
+
return input.replace(/([0-9]+(?:\.[0-9]+)?)\s*%/g, "$1 percent");
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Expand currency symbols, numbers, and percentages into their spoken
|
|
201
|
+
* word forms. Preserves punctuation and surrounding text — this is the
|
|
202
|
+
* surface that becomes `speechtext`.
|
|
203
|
+
*/
|
|
204
|
+
export function expandSpokenForms(input) {
|
|
205
|
+
let text = input.normalize("NFKC");
|
|
206
|
+
text = expandPercents(text);
|
|
207
|
+
text = expandCurrencySymbols(text);
|
|
208
|
+
text = text.replace(/(?<=\d),(?=\d)/g, "");
|
|
209
|
+
text = expandNumbers(text);
|
|
210
|
+
// Collapse any double-spaces introduced by symbol expansion.
|
|
211
|
+
return text.replace(/[ \t]+/g, " ");
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Strip a speechtext-form string into the alignment form: lowercase,
|
|
215
|
+
* punctuation removed, whitespace collapsed. Contractions are preserved
|
|
216
|
+
* (e.g. "don't" stays one token).
|
|
217
|
+
*/
|
|
218
|
+
export function stripForAlignment(input) {
|
|
219
|
+
let text = input.normalize("NFKC");
|
|
220
|
+
// Strip control (C0/C1) + DEL, then zero-width / BiDi formatting chars.
|
|
221
|
+
// Code-point filtering avoids embedding raw control bytes in a regex literal.
|
|
222
|
+
text = Array.from(text)
|
|
223
|
+
.map((ch) => {
|
|
224
|
+
const c = ch.codePointAt(0) ?? 0;
|
|
225
|
+
if (c <= 0x1f || (c >= 0x7f && c <= 0x9f))
|
|
226
|
+
return " ";
|
|
227
|
+
if (c === 0xa0)
|
|
228
|
+
return " ";
|
|
229
|
+
if ((c >= 0x200b && c <= 0x200f) ||
|
|
230
|
+
(c >= 0x202a && c <= 0x202e) ||
|
|
231
|
+
(c >= 0x2060 && c <= 0x2064)) {
|
|
232
|
+
return "";
|
|
233
|
+
}
|
|
234
|
+
return ch;
|
|
235
|
+
})
|
|
236
|
+
.join("");
|
|
237
|
+
// Quote / dash normalisation.
|
|
238
|
+
text = text.replace(/[“”„‟]/g, '"');
|
|
239
|
+
text = text.replace(/[‘’‚‛]/g, "'");
|
|
240
|
+
text = text.replace(/…/g, " ");
|
|
241
|
+
text = text.replace(/[-‐‑⁃–—−]/g, " ");
|
|
242
|
+
// Strip emoji + URLs + emails + handles before the catch-all punctuation pass.
|
|
243
|
+
text = text.replace(/\p{Extended_Pictographic}/gu, " ");
|
|
244
|
+
text = text.replace(/https?:\/\/\S+/gi, " ");
|
|
245
|
+
text = text.replace(/\bwww\.[^\s/]+\b/gi, " ");
|
|
246
|
+
text = text.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/gi, " ");
|
|
247
|
+
text = text.replace(/@\w+/g, " ");
|
|
248
|
+
// NFKD-then-strip-marks to drop combining diacritics.
|
|
249
|
+
text = text.normalize("NFKD").replace(/\p{M}/gu, "").normalize("NFKC");
|
|
250
|
+
// Strip stray apostrophes that aren't part of a contraction.
|
|
251
|
+
text = text.replace(/(^|[^A-Za-z0-9])'(?=[^A-Za-z0-9]|$)/g, "$1");
|
|
252
|
+
text = text.replace(/(^|[^A-Za-z0-9])'(?=[A-Za-z0-9])/g, "$1");
|
|
253
|
+
// Everything that's not a contraction-letter, digit, or whitespace -> space.
|
|
254
|
+
text = text.replace(/[^A-Za-z0-9'\s]/g, " ");
|
|
255
|
+
text = text.replace(/\s+/g, " ").trim();
|
|
256
|
+
return text.toLowerCase();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Produce both the speechtext (POSTed to synthesis) and
|
|
260
|
+
* normalisedSpeechtext (POSTed as the alignment transcript) forms from a
|
|
261
|
+
* single plain-text input.
|
|
262
|
+
*/
|
|
263
|
+
export function buildSpeechtextPair(plainText) {
|
|
264
|
+
const speechtext = expandSpokenForms(plainText);
|
|
265
|
+
const normalisedSpeechtext = stripForAlignment(speechtext);
|
|
266
|
+
return { speechtext, normalisedSpeechtext };
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* How many alignment tokens a visible string expands to. Used by the
|
|
270
|
+
* rehype plugin to compute `data-n` for each wrapped word / math unit.
|
|
271
|
+
* "$50" -> 2 ("fifty dollar"); "1995" -> 6; unambiguous words -> 1.
|
|
272
|
+
*/
|
|
273
|
+
export function spokenTokenCount(visible) {
|
|
274
|
+
const normalised = stripForAlignment(expandSpokenForms(visible));
|
|
275
|
+
if (!normalised)
|
|
276
|
+
return 0;
|
|
277
|
+
return normalised.split(/\s+/).filter(Boolean).length;
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=spoken-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spoken-form.js","sourceRoot":"","sources":["../../src/core/spoken-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,qBAAqB,GAA2B;IACpD,GAAG,EAAE,OAAO;IACZ,CAAC,EAAE,QAAQ;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;CACZ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C;IAClE,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;IAC/D,6EAA6E;IAC7E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;IAC7C,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IAInD,MAAM,UAAU,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAChD,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC,UAAU;QAAE,OAAO,CAAC,CAAC;IAC1B,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/latex-to-speech/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/latex-to-speech/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CA+BnB;AAED,eAAe,aAAa,CAAC"}
|