@yomiscript/core 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +13 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +1 -0
- package/dist/instructions.js +17 -0
- package/dist/instructions.js.map +1 -0
- package/dist/katarite.d.ts +23 -0
- package/dist/katarite.js +4 -0
- package/dist/katarite.js.map +1 -0
- package/dist/node.d.ts +11 -0
- package/dist/node.js +29 -0
- package/dist/node.js.map +1 -0
- package/dist/yomiscript.d.ts +54 -0
- package/dist/yomiscript.js +403 -0
- package/dist/yomiscript.js.map +1 -0
- package/dist/yomite.d.ts +18 -0
- package/dist/yomite.js +133 -0
- package/dist/yomite.js.map +1 -0
- package/package.json +35 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @yomiscript/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
YomiScript: the notation in which an LLM (or any Yomite) writes how a text is read, and a Katarite turns it into
|
|
4
|
+
sound. Specification: `spec/yomiscript/README.md` in the repository.
|
|
5
|
+
|
|
6
|
+
- `parse(ys)`: an utterance -> language sections -> tokens (morae / syllables, boundaries, pauses), with `<f0:…>`
|
|
7
|
+
pitch values and the original text of each span (`<t:…>`, D23). Errors explain what to write instead.
|
|
8
|
+
- `realize(ys, { dialect })`: the reference rule-based prosody (accent / stress / tone marks -> `<f0:…>` values).
|
|
9
|
+
- `Katarite`, `Speech`, `SpanTime`: the interface every Katarite offers (YomiScript in; audio and when each span is
|
|
10
|
+
spoken out).
|
|
11
|
+
- `YOMISCRIPT_INSTRUCTIONS`: what an LLM needs to write YomiScript; the description of the `speak` tool in the MCP
|
|
12
|
+
server and the gui-chat-protocol plugin.
|
|
13
|
+
- `LoadBytes`: how a Katarite's engine reads a model file. `@yomiscript/core/node` has `cachedLoader({ dir, baseUrl })`,
|
|
14
|
+
which reads from a directory and downloads a missing file into it once (Node only).
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const YOMISCRIPT_INSTRUCTIONS = "Write what you want to say as YomiScript, a pronunciation notation: you decide how every word is read, from its context.\n\n- One utterance: `<lang> /\u2026 \u2198/` for a statement, `<lang> /\u2026 \u2197/` for a question. `<lang>` is a BCP 47 tag (`ja`, `en-US`).\n- The pronunciation is IPA, as the words are actually spoken: numbers, dates, symbols and abbreviations spelled out, and each word read the way it is meant here.\n - Japanese: phonemic IPA, mora by mora. Rows: a i \u026F e o; ka ki k\u026F ke ko (k\u02B2a k\u02B2\u026F k\u02B2o); sa \u0255i s\u026F se so (\u0255a \u0255\u026F \u0255o); dza d\u0291i dz\u026F dze dzo; ta t\u0255i ts\u026F te to (t\u0255a t\u0255\u026F t\u0255o); da de do; na \u0272i n\u026F ne no (\u0272a \u0272\u026F \u0272o); ha \u00E7i \u0278\u026F he ho (\u00E7a \u00E7\u026F \u00E7o); ba bi b\u026F be bo; pa pi p\u026F pe po; ma mi m\u026F me mo (m\u02B2a\u2026); ja j\u026F jo; wa; \u027Ea \u027Ei \u027E\u026F \u027Ee \u027Eo (\u027E\u02B2a\u2026). Loanword sounds: ti di t\u026F \u0278a \u0278i \u0278e \u0278o wi we wo tsa va. Particles: \u306F `wa`, \u3078 `e`, \u3092 `o`. Long vowel `\u02D0` as pronounced (\u5148\u751F `se\u02D0se\u02D0`). Geminate: double the next consonant (`kitte`; before t\u0255 / ts write `t`: `matt\u0255i`), `\u0294` before a vowel or at the end. \u30F3: `m` before p b m, `n` before t d n \u027E dz, `\u0272` before t\u0255 d\u0291 \u0272, `\u014B` before k \u0261, `\u0274` otherwise. Latin letters and symbols as a Japanese speaker says them (iPhone `ai\u0278o\u0274`). Separate words with spaces.\n - English: IPA with `\u02C8` / `\u02CC` stress at the start of the syllable, `.` between syllables, spaces between words.\n- ` \u2016 ` marks a pause (a comma). Several sentences stay one utterance: end each inner sentence with ` \u2198 ` or ` \u2197 `.\n- After each word, write the text it reads in `<t:\u2026>`, so that joining them gives back your text exactly: punctuation goes with the word before it (`des\u026F<t:\u3067\u3059\u3002>`) or in its own `<t:\u2026>` where nothing is spoken (`\u2016<t:\u3001>`); in English write the spaces too (`\u02C8w\u025Dld<t: world.>`).\n- No pitch values and no accent marks: the synthesizer makes the prosody.\n\nExamples:\nja /\u0255\u026F\u02D0mats\u026F<t:\u9031\u672B> wa<t:\u306F> \u2016<t:\u3001> tomodat\u0255i<t:\u53CB\u9054> to<t:\u3068> k\u02B2o\u02D0to<t:\u4EAC\u90FD> e<t:\u3078> ik\u026F<t:\u884C\u304F> jote\u02D0<t:\u4E88\u5B9A> des\u026F<t:\u3067\u3059\u3002> \u2198/\nja /ts\u026Fitat\u0255i<t:\u4E00\u65E5> ka\u027Ea<t:\u304B\u3089> mikka<t:\u4E09\u65E5> made<t:\u307E\u3067> jas\u026Fmi<t:\u4F11\u307F> des\u026F<t:\u3067\u3059\u3002> \u2198/\nen-US /\u02CCa\u026A<t:I> \u02C8\u0279\u025Bd<t: read> \u00F0\u0259<t: the> \u02C8l\u025B.\u027E\u0259\u0279<t: letter> \u02C8twa\u026As<t: twice,> \u2016 \u02CCb\u028Ct<t: but> \u026At<t: it> \u02C8st\u026Al<t: still> \u02CCme\u026Ad<t: made> \u02C8no\u028A<t: no> \u02C8s\u025Bns<t: sense.> \u2198/";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The instructions an LLM needs to write YomiScript for a Katarite: the text of a tool description (MCP, gui-chat-protocol)
|
|
2
|
+
// or a system prompt. The same subset was measured in eval/browser_tts (prompt.md there is the experiment's frozen copy).
|
|
3
|
+
export const YOMISCRIPT_INSTRUCTIONS = `Write what you want to say as YomiScript, a pronunciation notation: you decide how every word is read, from its context.
|
|
4
|
+
|
|
5
|
+
- One utterance: \`<lang> /… ↘/\` for a statement, \`<lang> /… ↗/\` for a question. \`<lang>\` is a BCP 47 tag (\`ja\`, \`en-US\`).
|
|
6
|
+
- The pronunciation is IPA, as the words are actually spoken: numbers, dates, symbols and abbreviations spelled out, and each word read the way it is meant here.
|
|
7
|
+
- Japanese: phonemic IPA, mora by mora. Rows: a i ɯ e o; ka ki kɯ ke ko (kʲa kʲɯ kʲo); sa ɕi sɯ se so (ɕa ɕɯ ɕo); dza dʑi dzɯ dze dzo; ta tɕi tsɯ te to (tɕa tɕɯ tɕo); da de do; na ɲi nɯ ne no (ɲa ɲɯ ɲo); ha çi ɸɯ he ho (ça çɯ ço); ba bi bɯ be bo; pa pi pɯ pe po; ma mi mɯ me mo (mʲa…); ja jɯ jo; wa; ɾa ɾi ɾɯ ɾe ɾo (ɾʲa…). Loanword sounds: ti di tɯ ɸa ɸi ɸe ɸo wi we wo tsa va. Particles: は \`wa\`, へ \`e\`, を \`o\`. Long vowel \`ː\` as pronounced (先生 \`seːseː\`). Geminate: double the next consonant (\`kitte\`; before tɕ / ts write \`t\`: \`mattɕi\`), \`ʔ\` before a vowel or at the end. ン: \`m\` before p b m, \`n\` before t d n ɾ dz, \`ɲ\` before tɕ dʑ ɲ, \`ŋ\` before k ɡ, \`ɴ\` otherwise. Latin letters and symbols as a Japanese speaker says them (iPhone \`aiɸoɴ\`). Separate words with spaces.
|
|
8
|
+
- English: IPA with \`ˈ\` / \`ˌ\` stress at the start of the syllable, \`.\` between syllables, spaces between words.
|
|
9
|
+
- \` ‖ \` marks a pause (a comma). Several sentences stay one utterance: end each inner sentence with \` ↘ \` or \` ↗ \`.
|
|
10
|
+
- After each word, write the text it reads in \`<t:…>\`, so that joining them gives back your text exactly: punctuation goes with the word before it (\`desɯ<t:です。>\`) or in its own \`<t:…>\` where nothing is spoken (\`‖<t:、>\`); in English write the spaces too (\`ˈwɝld<t: world.>\`).
|
|
11
|
+
- No pitch values and no accent marks: the synthesizer makes the prosody.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
ja /ɕɯːmatsɯ<t:週末> wa<t:は> ‖<t:、> tomodatɕi<t:友達> to<t:と> kʲoːto<t:京都> e<t:へ> ikɯ<t:行く> joteː<t:予定> desɯ<t:です。> ↘/
|
|
15
|
+
ja /tsɯitatɕi<t:一日> kaɾa<t:から> mikka<t:三日> made<t:まで> jasɯmi<t:休み> desɯ<t:です。> ↘/
|
|
16
|
+
en-US /ˌaɪ<t:I> ˈɹɛd<t: read> ðə<t: the> ˈlɛ.ɾəɹ<t: letter> ˈtwaɪs<t: twice,> ‖ ˌbʌt<t: but> ɪt<t: it> ˈstɪl<t: still> ˌmeɪd<t: made> ˈnoʊ<t: no> ˈsɛns<t: sense.> ↘/`;
|
|
17
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,4HAA4H;AAC5H,0HAA0H;AAE1H,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;sKAa+H,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface SpanTime {
|
|
2
|
+
/** index into parse(ys).texts */
|
|
3
|
+
span: number;
|
|
4
|
+
/** seconds from the start of the audio */
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Speech {
|
|
9
|
+
samples: Float32Array;
|
|
10
|
+
sampleRate: number;
|
|
11
|
+
/** the original text of each span (<t:…>), empty when the YomiScript has none */
|
|
12
|
+
texts: string[];
|
|
13
|
+
/** when each span is spoken; may be empty when the engine cannot tell */
|
|
14
|
+
times: SpanTime[];
|
|
15
|
+
}
|
|
16
|
+
export interface Katarite {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
/** the languages it speaks (BCP 47 primary tags) */
|
|
19
|
+
readonly languages: readonly string[];
|
|
20
|
+
speak(ys: string): Promise<Speech>;
|
|
21
|
+
}
|
|
22
|
+
/** how a Katarite's engine reads a file of its model directory (in the browser a fetch, in Node a file or a download) */
|
|
23
|
+
export type LoadBytes = (path: string) => Promise<Uint8Array | ArrayBuffer>;
|
package/dist/katarite.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"katarite.js","sourceRoot":"","sources":["../src/katarite.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,uGAAuG"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LoadBytes } from "./katarite.ts";
|
|
2
|
+
export interface CachedLoaderOptions {
|
|
3
|
+
/** the directory the files are read from and downloaded into */
|
|
4
|
+
dir: string;
|
|
5
|
+
/** where missing files are downloaded from (ends with "/"); none: a missing file is an error */
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
/** called before each download, e.g. to tell the user (the first run downloads hundreds of MB) */
|
|
8
|
+
onDownload?: (url: string) => void;
|
|
9
|
+
fetch?: typeof globalThis.fetch;
|
|
10
|
+
}
|
|
11
|
+
export declare function cachedLoader({ dir, baseUrl, onDownload, fetch }: CachedLoaderOptions): LoadBytes;
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// What the Node Katarites share: a loader that reads model files from a directory and, when a file is missing,
|
|
2
|
+
// downloads it once from a base URL (Hugging Face) into that directory.
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
const missing = (e) => e.code === "ENOENT";
|
|
6
|
+
export function cachedLoader({ dir, baseUrl, onDownload, fetch = globalThis.fetch }) {
|
|
7
|
+
return async (file) => {
|
|
8
|
+
const local = path.join(dir, file);
|
|
9
|
+
try {
|
|
10
|
+
return new Uint8Array(await fs.readFile(local));
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
if (!missing(e) || !baseUrl)
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
const url = new URL(file, baseUrl).href;
|
|
17
|
+
onDownload?.(url);
|
|
18
|
+
const res = await fetch(url);
|
|
19
|
+
if (!res.ok)
|
|
20
|
+
throw new Error(`download failed: ${url} (${res.status} ${res.statusText})`);
|
|
21
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
22
|
+
await fs.mkdir(path.dirname(local), { recursive: true });
|
|
23
|
+
const tmp = `${local}.${process.pid}.part`; // written whole, then renamed: an interrupted download leaves no file
|
|
24
|
+
await fs.writeFile(tmp, bytes);
|
|
25
|
+
await fs.rename(tmp, local);
|
|
26
|
+
return bytes;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,wEAAwE;AACxE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAa7B,MAAM,OAAO,GAAG,CAAC,CAAU,EAAE,EAAE,CAAE,CAA2B,CAAC,IAAI,KAAK,QAAQ,CAAC;AAE/E,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AAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type TokenKind = "unit" | "space" | "pause" | "bound" | "punct" | "end";
|
|
2
|
+
/** Japanese mora kinds: a mora, the moraic nasal N, a geminate / glottal stop Q, a long vowel R */
|
|
3
|
+
export type MoraKind = "mora" | "N" | "Q" | "R";
|
|
4
|
+
export interface Token {
|
|
5
|
+
kind: TokenKind;
|
|
6
|
+
/** accent phrase index within the section */
|
|
7
|
+
ph: number;
|
|
8
|
+
/** boundary / punctuation / end symbol ('#', '_', '.', '?', or the text of <p:…>) */
|
|
9
|
+
sym?: string;
|
|
10
|
+
/** a sentence end inside the utterance (' ↘ ' / ' ↗ ') */
|
|
11
|
+
sent?: boolean;
|
|
12
|
+
/** pitch values written after the unit */
|
|
13
|
+
f0?: number[] | null;
|
|
14
|
+
/** the <t:…> span this unit reads (index into Utterance.texts, D23) */
|
|
15
|
+
span?: number;
|
|
16
|
+
start?: number;
|
|
17
|
+
end?: number;
|
|
18
|
+
vend?: number;
|
|
19
|
+
lang?: string;
|
|
20
|
+
mk?: MoraKind;
|
|
21
|
+
on?: string;
|
|
22
|
+
v?: string;
|
|
23
|
+
ipa?: string;
|
|
24
|
+
dev?: boolean;
|
|
25
|
+
rise?: boolean;
|
|
26
|
+
fall?: boolean;
|
|
27
|
+
chunk?: number;
|
|
28
|
+
k?: number;
|
|
29
|
+
hasRise?: boolean;
|
|
30
|
+
raw?: string;
|
|
31
|
+
j?: number;
|
|
32
|
+
nsyl?: number;
|
|
33
|
+
st?: string;
|
|
34
|
+
tone?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Section {
|
|
37
|
+
lang: string;
|
|
38
|
+
text: string;
|
|
39
|
+
base: number;
|
|
40
|
+
end: "$" | "?";
|
|
41
|
+
toks: Token[];
|
|
42
|
+
}
|
|
43
|
+
export interface Utterance {
|
|
44
|
+
/** the string as written (trimmed), annotations included */
|
|
45
|
+
ys: string;
|
|
46
|
+
top: string;
|
|
47
|
+
end: "$" | "?";
|
|
48
|
+
sections: Section[];
|
|
49
|
+
/** the original text of each span (<t:…>, D23), in order */
|
|
50
|
+
texts: string[];
|
|
51
|
+
}
|
|
52
|
+
export declare const isJa: (l: string) => boolean;
|
|
53
|
+
export declare const VOWELS = "aeiou\u00E6\u0251\u0252\u0254\u0259\u025A\u025B\u025C\u026A\u028A\u028C\u1D4A\u0250\u00F8\u0153";
|
|
54
|
+
export declare function parse(written: string): Utterance;
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
// YomiScript notation — no engine, voice or language rules.
|
|
2
|
+
// Utterance: `<lang> /… ↘/` (or ↗ for a question), lang = BCP 47 language (no dialect tags). Inside: ` | ` accent phrase,
|
|
3
|
+
// ` ‖ ` breath group / pause, `{<lang> …}` a section in another language.
|
|
4
|
+
// parse(): utterance -> language sections -> tokens (units = mora / syllable, plus space / pause / boundary / end).
|
|
5
|
+
// Accent, stress and tone marks are kept on the tokens; pitch values <f0:v,…> (semitones relative to the
|
|
6
|
+
// speaker's register) attach to the unit right before them. Offsets point into the trimmed utterance string.
|
|
7
|
+
const LANG = "[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*";
|
|
8
|
+
const UTT = new RegExp(`^(${LANG})\\s*/(.*?)\\s*([↘↗])\\s*/$`, "s");
|
|
9
|
+
const TAG = new RegExp(`\\{(${LANG}) ([^{}]*)\\}`, "g");
|
|
10
|
+
export const isJa = (l) => l === "ja" || l.startsWith("ja-");
|
|
11
|
+
export const VOWELS = "aeiouæɑɒɔəɚɛɜɪʊʌᵊɐøœ"; // IPA vowel letters of the syllable languages (en, fr); diacritics follow them
|
|
12
|
+
const SEPS = { "|": "#", "‖": "_" }; // internal names: '#' accent phrase, '_' pause
|
|
13
|
+
const SEP = (s) => (s !== undefined && SEPS[s]) || null;
|
|
14
|
+
const inStr = (ch, s) => s.includes(ch);
|
|
15
|
+
function f0At(s, i) {
|
|
16
|
+
// '<f0:1.5,-2>' at i -> [values, index after '>'] or null
|
|
17
|
+
if (!s.startsWith("<f0:", i)) return null;
|
|
18
|
+
const j = s.indexOf(">", i);
|
|
19
|
+
if (j < 0) throw new Error(`unclosed <f0: in ${JSON.stringify(s)}`);
|
|
20
|
+
const v = s
|
|
21
|
+
.slice(i + 4, j)
|
|
22
|
+
.split(",")
|
|
23
|
+
.map(Number);
|
|
24
|
+
if (v.some((x) => isNaN(x))) throw new Error(`bad pitch value ${s.slice(i, j + 1)}`);
|
|
25
|
+
return [v, j + 1];
|
|
26
|
+
}
|
|
27
|
+
function whyNot(s) {
|
|
28
|
+
if (!s) return "empty input";
|
|
29
|
+
if (/^\^|[$?]$/.test(s)) return "old notation (^…$ / ^lang|…); write <lang> /… ↘/";
|
|
30
|
+
if (!new RegExp(`^${LANG}\\s*/`).test(s)) return 'missing language tag before the opening "/" (e.g. "ja /")';
|
|
31
|
+
if (!/\/\s*$/.test(s)) return 'missing closing "/"';
|
|
32
|
+
if (!/[↘↗]\s*\/\s*$/.test(s)) return 'missing sentence-final ↘ or ↗ before the closing "/"';
|
|
33
|
+
return "not YomiScript";
|
|
34
|
+
}
|
|
35
|
+
function takeTexts(ys) {
|
|
36
|
+
let out = "";
|
|
37
|
+
const map = [],
|
|
38
|
+
texts = [];
|
|
39
|
+
for (let i = 0; i < ys.length;) {
|
|
40
|
+
if (ys.startsWith("<t:", i)) {
|
|
41
|
+
const j = ys.indexOf(">", i);
|
|
42
|
+
if (j < 0) throw new Error(`unclosed <t: in ${JSON.stringify(ys)}`);
|
|
43
|
+
texts.push({ text: ys.slice(i + 3, j), at: out.length });
|
|
44
|
+
i = j + 1;
|
|
45
|
+
} else {
|
|
46
|
+
map.push(i);
|
|
47
|
+
out += ys[i++];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
map.push(ys.length);
|
|
51
|
+
return { out, map, texts };
|
|
52
|
+
}
|
|
53
|
+
function spanOf(texts, t) {
|
|
54
|
+
if (t.kind !== "unit" || !texts.length || t.end === undefined) return;
|
|
55
|
+
const end = t.end;
|
|
56
|
+
const k = texts.findIndex((x) => x.at >= end);
|
|
57
|
+
if (k >= 0) t.span = k;
|
|
58
|
+
}
|
|
59
|
+
function mapOffsets(map, t) {
|
|
60
|
+
if (typeof t.start === "number") t.start = map[t.start];
|
|
61
|
+
// exclusive ends: one past the last character
|
|
62
|
+
if (t.end !== undefined && t.end > 0) t.end = map[t.end - 1] + 1;
|
|
63
|
+
if (t.vend !== undefined && t.vend > 0) t.vend = map[t.vend - 1] + 1;
|
|
64
|
+
}
|
|
65
|
+
function placeTexts(S, T) {
|
|
66
|
+
// each unit gets the span it reads (index into texts), then offsets go back to the annotated string
|
|
67
|
+
for (const sec of S) {
|
|
68
|
+
sec.base = T.map[sec.base];
|
|
69
|
+
for (const t of sec.toks) {
|
|
70
|
+
spanOf(T.texts, t);
|
|
71
|
+
mapOffsets(T.map, t);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function splitSections(top, b, b0) {
|
|
76
|
+
// the top language and the {<lang> …} sections in order, with their offsets
|
|
77
|
+
const P = [];
|
|
78
|
+
let pos = 0;
|
|
79
|
+
for (const mm of b.matchAll(TAG)) {
|
|
80
|
+
const at = mm.index ?? 0;
|
|
81
|
+
P.push([top, pos, b.slice(pos, at)], [mm[1], at + mm[1].length + 2, mm[2]]);
|
|
82
|
+
pos = at + mm[0].length;
|
|
83
|
+
}
|
|
84
|
+
P.push([top, pos, b.slice(pos)]);
|
|
85
|
+
const S = [];
|
|
86
|
+
for (const [l, s, x] of P) {
|
|
87
|
+
let a = 0,
|
|
88
|
+
z = x.length;
|
|
89
|
+
while (a < z && inStr(x[a], " |‖")) a++;
|
|
90
|
+
while (z > a && inStr(x[z - 1], " |‖")) z--;
|
|
91
|
+
if (a < z) S.push({ lang: l, text: x.slice(a, z), base: b0 + s + a });
|
|
92
|
+
}
|
|
93
|
+
return S;
|
|
94
|
+
}
|
|
95
|
+
export function parse(written) {
|
|
96
|
+
written = written.trim();
|
|
97
|
+
const T = takeTexts(written),
|
|
98
|
+
ys = T.out;
|
|
99
|
+
const m = ys.match(UTT);
|
|
100
|
+
if (!m) throw new Error(`${whyNot(ys)} — got ${JSON.stringify(ys.length > 60 ? ys.slice(0, 60) + "…" : ys)}. YomiScript looks like ja /kʲoꜜːwa | aꜜmeɡa ↘/`);
|
|
101
|
+
const top = m[1],
|
|
102
|
+
end = m[3] === "↗" ? "?" : "$";
|
|
103
|
+
const parts = splitSections(top, m[2], ys.indexOf("/") + 1);
|
|
104
|
+
const S = parts.map((p, i) => {
|
|
105
|
+
const sec = { ...p, end: i === parts.length - 1 ? end : "$", toks: segment(p.lang, p.text, p.base) };
|
|
106
|
+
const last = [...sec.toks].reverse().find((t) => t.kind !== "bound");
|
|
107
|
+
sec.toks.push({ kind: "end", sym: endSym(sec.end, last), ph: last ? last.ph : 0 });
|
|
108
|
+
return sec;
|
|
109
|
+
});
|
|
110
|
+
placeTexts(S, T);
|
|
111
|
+
return { ys: written, top, end, sections: S, texts: T.texts.map((x) => x.text) };
|
|
112
|
+
}
|
|
113
|
+
// the final ↘ / ↗ is the engine's '.' / '?'; ↘ adds nothing if the utterance already ends with punctuation (<p:!> …)
|
|
114
|
+
function endSym(end, last) {
|
|
115
|
+
if (end === "?") return "?";
|
|
116
|
+
return last?.kind === "punct" ? "" : ".";
|
|
117
|
+
}
|
|
118
|
+
function segment(lang, t, base) {
|
|
119
|
+
if (isJa(lang)) return jaSeg(t, base);
|
|
120
|
+
return lang === "zh" ? zhSeg(t, base) : euSeg(t, base);
|
|
121
|
+
}
|
|
122
|
+
// ---- Japanese: IPA morae with ꜛ (rise) / ꜜ (accent nucleus); '.' and spaces optional
|
|
123
|
+
const JV = "aiɯeouɨ",
|
|
124
|
+
JNAS = "mnɲŋɴ",
|
|
125
|
+
DEVOICE = "̥";
|
|
126
|
+
const JAFF = ["tɕ", "dʑ", "ts", "dz", "ʨ", "ʥ", "ʦ", "ʣ"];
|
|
127
|
+
const JCONS = "kɡsɕztdnɲhçɸbpmjwɾvʔŋɴʑβ";
|
|
128
|
+
function jaTokens(c, base) {
|
|
129
|
+
const T = [];
|
|
130
|
+
for (let i = 0; i < c.length;) {
|
|
131
|
+
const ch = c[i],
|
|
132
|
+
at = base + i;
|
|
133
|
+
if (ch === "." || ch === " ") {
|
|
134
|
+
i++;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const f = f0At(c, i);
|
|
138
|
+
if (f) {
|
|
139
|
+
T.push({ t: "F", v: f[0] });
|
|
140
|
+
i = f[1];
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (ch === "ꜛ" || ch === "ꜜ") {
|
|
144
|
+
T.push({ t: ch });
|
|
145
|
+
i++;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (ch === "ː") {
|
|
149
|
+
T.push({ t: "R", s: "ː", end: at + 1 });
|
|
150
|
+
i++;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (inStr(ch, JV)) {
|
|
154
|
+
let dev = false;
|
|
155
|
+
i++;
|
|
156
|
+
if (c[i] === DEVOICE) {
|
|
157
|
+
dev = true;
|
|
158
|
+
i++;
|
|
159
|
+
}
|
|
160
|
+
T.push({ t: "V", s: ch, dev, vend: at + 1, end: base + i });
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
const [s, j] = jaConsonant(c, i);
|
|
164
|
+
i = j;
|
|
165
|
+
T.push({ t: "C", s, end: base + i });
|
|
166
|
+
}
|
|
167
|
+
return T;
|
|
168
|
+
}
|
|
169
|
+
function jaConsonant(c, i) {
|
|
170
|
+
// the consonant at i (with ʲ / ʷ) -> [symbol, index after it]
|
|
171
|
+
const ch = c[i],
|
|
172
|
+
two = c.slice(i, i + 2);
|
|
173
|
+
let s = ch;
|
|
174
|
+
if (JAFF.includes(two)) s = two;
|
|
175
|
+
else if (ch === "g")
|
|
176
|
+
s = "ɡ"; // IPA: g = ɡ
|
|
177
|
+
else if (!JAFF.includes(ch) && !inStr(ch, JCONS)) {
|
|
178
|
+
const kana = /[-ヿ]/.test(ch) ? " (kana is not YomiScript; write IPA with ꜛ ꜜ)" : "";
|
|
179
|
+
throw new Error(`not Japanese YomiScript IPA: ${JSON.stringify(ch)} in ${JSON.stringify(c)}${kana}`);
|
|
180
|
+
}
|
|
181
|
+
i += JAFF.includes(two) ? 2 : 1;
|
|
182
|
+
if (c[i] === "ʲ" || c[i] === "ʷ") return [s + c[i], i + 1];
|
|
183
|
+
return [s, i];
|
|
184
|
+
}
|
|
185
|
+
function jaMoras(c, base) {
|
|
186
|
+
// -> morae [{kind:'mora'|'N'|'Q'|'R', on, v, ipa, dev, vend, end, f0, rise, fall}] (as units: kind 'unit', mora kind in mk)
|
|
187
|
+
const T = jaTokens(c, base),
|
|
188
|
+
M = [];
|
|
189
|
+
let on = "";
|
|
190
|
+
const next = (i) => {
|
|
191
|
+
for (let j = i + 1; j < T.length; j++) if (T[j].t === "C" || T[j].t === "V" || T[j].t === "R") return T[j];
|
|
192
|
+
return null;
|
|
193
|
+
};
|
|
194
|
+
const add = (o) => M.push({ rise: false, fall: false, f0: null, dev: false, ...o });
|
|
195
|
+
T.forEach((x, i) => {
|
|
196
|
+
if (x.t === "ꜛ" || x.t === "ꜜ" || x.t === "F") {
|
|
197
|
+
markLast(M, x, on, c);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (x.t === "R") {
|
|
201
|
+
add({ kind: "R", ipa: "ː", end: x.end });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const s = x.s ?? "";
|
|
205
|
+
if (x.t === "V") {
|
|
206
|
+
add({ kind: "mora", on, v: s, ipa: on + s, dev: x.dev, vend: x.vend, end: x.end });
|
|
207
|
+
on = "";
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const kind = on ? null : specialMora(s, next(i));
|
|
211
|
+
if (kind) {
|
|
212
|
+
add({ kind, ipa: s, end: x.end });
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (on && !inStr(s, "jw")) throw new Error(`unexpected consonant cluster ${on}${s} in ${JSON.stringify(c)}`);
|
|
216
|
+
on += s;
|
|
217
|
+
});
|
|
218
|
+
if (on) throw new Error(`consonant ${on} without a vowel in ${JSON.stringify(c)}`);
|
|
219
|
+
return M;
|
|
220
|
+
}
|
|
221
|
+
function markLast(M, x, on, c) {
|
|
222
|
+
// ꜛ / ꜜ / <f0:…> -> on the mora before it
|
|
223
|
+
if (x.t === "F") {
|
|
224
|
+
if (on || !M.length) throw new Error(`<f0:…> must follow a mora in ${JSON.stringify(c)}`);
|
|
225
|
+
M[M.length - 1].f0 = x.v;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (on) throw new Error(`accent mark inside a mora in ${JSON.stringify(c)}`);
|
|
229
|
+
if (M.length) M[M.length - 1][x.t === "ꜛ" ? "rise" : "fall"] = true;
|
|
230
|
+
}
|
|
231
|
+
function specialMora(s, n) {
|
|
232
|
+
// a consonant with no onset before it: 'N' (moraic nasal), 'Q' (glottal stop, geminate) or null (an onset)
|
|
233
|
+
if (s === "ɴ") return "N";
|
|
234
|
+
if (s === "ʔ") return "Q";
|
|
235
|
+
if (inStr(s, JNAS) && n?.t !== "V") return "N"; // moraic nasal before a consonant or the end
|
|
236
|
+
if (n?.t === "C" && !inStr(s, "jw") && !inStr(n.s ?? "", "jw")) return "Q"; // geminate
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
function jaWordSpans(t) {
|
|
240
|
+
// [start, end] of each word; ' | ' and ' ‖ ' are words of their own even without spaces around them
|
|
241
|
+
const W = [];
|
|
242
|
+
for (let i = 0, s = -1; i <= t.length; i++) {
|
|
243
|
+
const c = t[i];
|
|
244
|
+
if (i === t.length || c === " " || SEP(c)) {
|
|
245
|
+
if (s >= 0) W.push([s, i]);
|
|
246
|
+
s = -1;
|
|
247
|
+
if (c && SEP(c)) W.push([i, i + 1]);
|
|
248
|
+
} else if (s < 0) s = i;
|
|
249
|
+
}
|
|
250
|
+
return W;
|
|
251
|
+
}
|
|
252
|
+
function jaWordItems(w, at) {
|
|
253
|
+
// one word -> morae and <p:…> in order
|
|
254
|
+
const items = [];
|
|
255
|
+
for (let i = 0, s = 0; i <= w.length;) {
|
|
256
|
+
const p = i < w.length ? pAt(w, i) : null;
|
|
257
|
+
if (i === w.length || p) {
|
|
258
|
+
if (i > s) items.push(...jaMoras(w.slice(s, i), at + s));
|
|
259
|
+
if (!p) break;
|
|
260
|
+
items.push({ kind: "punct", sym: p[0] });
|
|
261
|
+
i = s = p[1];
|
|
262
|
+
} else i = w.startsWith("<f0:", i) ? w.indexOf(">", i) + 1 || w.length : i + 1;
|
|
263
|
+
}
|
|
264
|
+
return items;
|
|
265
|
+
}
|
|
266
|
+
function jaSeg(t, base) {
|
|
267
|
+
// words (spaces), ' | ' / ' ‖ ' / ' ↘ ' / ' ↗ ' between them, <p:…> inside or as a word; morae per accent phrase
|
|
268
|
+
const out = [];
|
|
269
|
+
let ph = 0,
|
|
270
|
+
chunk = 0,
|
|
271
|
+
cur = [];
|
|
272
|
+
const flush = () => {
|
|
273
|
+
// one accent phrase: morae numbered k within it; spaces and <p:…> kept in place
|
|
274
|
+
const M = cur.filter((x) => x.kind !== "space" && x.kind !== "punct"),
|
|
275
|
+
hasRise = M.some((m) => m.rise);
|
|
276
|
+
let k = 0;
|
|
277
|
+
for (const x of cur)
|
|
278
|
+
out.push(x.kind === "space" || x.kind === "punct" ? { ...x, ph } : { ...x, mk: x.kind, kind: "unit", lang: "ja", ph, chunk, k: k++, hasRise });
|
|
279
|
+
if (M.length) chunk++;
|
|
280
|
+
cur = [];
|
|
281
|
+
};
|
|
282
|
+
for (const [a, z] of jaWordSpans(t)) {
|
|
283
|
+
const w = t.slice(a, z),
|
|
284
|
+
b = boundary(w, ph, true);
|
|
285
|
+
if (b) {
|
|
286
|
+
flush();
|
|
287
|
+
out.push(...b.filter((x) => x.kind !== "bound" || x.sym === "#"));
|
|
288
|
+
ph++;
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const L = cur.length ? cur[cur.length - 1] : lastTok(out);
|
|
292
|
+
if (L && L.kind !== "pause") cur.push({ kind: "space" });
|
|
293
|
+
cur.push(...jaWordItems(w, base + a));
|
|
294
|
+
}
|
|
295
|
+
flush();
|
|
296
|
+
return out;
|
|
297
|
+
}
|
|
298
|
+
const lastTok = (out) => [...out].reverse().find((x) => x.kind !== "bound");
|
|
299
|
+
function boundary(w, ph, sent = false) {
|
|
300
|
+
// ' | ' / ' ‖ ' -> bound (+ pause); a sentence end inside the utterance ' ↘ ' / ' ↗ ' -> punct; otherwise null
|
|
301
|
+
const sep = SEP(w);
|
|
302
|
+
if (sep)
|
|
303
|
+
return sep === "_"
|
|
304
|
+
? [
|
|
305
|
+
{ kind: "bound", sym: sep, ph },
|
|
306
|
+
{ kind: "pause", ph },
|
|
307
|
+
]
|
|
308
|
+
: [{ kind: "bound", sym: sep, ph }];
|
|
309
|
+
if (w === "↘" || w === "↗") return [{ kind: "punct", sym: w === "↗" ? "?" : ".", ...(sent ? { sent } : {}), ph }];
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
function words(t, base, unit) {
|
|
313
|
+
// English / French / Chinese: words separated by spaces; unit(word, offset, ph) -> tokens of one word
|
|
314
|
+
const out = [];
|
|
315
|
+
let ph = 0,
|
|
316
|
+
pos = 0;
|
|
317
|
+
for (const w of t.split(" ")) {
|
|
318
|
+
const o = base + pos;
|
|
319
|
+
pos += w.length + 1;
|
|
320
|
+
if (!w) continue;
|
|
321
|
+
const b = boundary(w, ph);
|
|
322
|
+
if (b) {
|
|
323
|
+
out.push(...b);
|
|
324
|
+
ph++;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
const L = lastTok(out);
|
|
328
|
+
if (L && L.kind !== "pause") out.push({ kind: "space", ph });
|
|
329
|
+
out.push(...unit(w, o, ph));
|
|
330
|
+
}
|
|
331
|
+
return out;
|
|
332
|
+
}
|
|
333
|
+
// ---- English / French: IPA syllables ('.'), words (' '), stress ˈ ˌ, liaison ‿ ; boundaries ' | ' ' ‖ ' as words;
|
|
334
|
+
// a sentence end inside the utterance ' ↘ ' / ' ↗ '; punctuation the engine uses as a prosodic cue: <p:…>
|
|
335
|
+
function pAt(s, i) {
|
|
336
|
+
if (!s.startsWith("<p:", i)) return null;
|
|
337
|
+
const j = s.indexOf(">", i + 3);
|
|
338
|
+
if (j < 0) throw new Error(`unclosed <p: in ${JSON.stringify(s)}`);
|
|
339
|
+
return [s.slice(i + 3, j), j + 1];
|
|
340
|
+
}
|
|
341
|
+
function sylls(w, base) {
|
|
342
|
+
// -> syllables {raw,start,end,f0} and punctuation {punct:sym} in order; '.' splits syllables outside <…>
|
|
343
|
+
const R = [];
|
|
344
|
+
let raw = "",
|
|
345
|
+
start = base,
|
|
346
|
+
f0 = null,
|
|
347
|
+
end = base;
|
|
348
|
+
const flush = () => {
|
|
349
|
+
if (raw || f0) R.push({ raw, start, end, f0 });
|
|
350
|
+
raw = "";
|
|
351
|
+
f0 = null;
|
|
352
|
+
};
|
|
353
|
+
for (let i = 0; i <= w.length;) {
|
|
354
|
+
if (i === w.length || w[i] === ".") {
|
|
355
|
+
flush();
|
|
356
|
+
start = base + i + 1;
|
|
357
|
+
end = start;
|
|
358
|
+
i++;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const f = f0At(w, i);
|
|
362
|
+
if (f) {
|
|
363
|
+
f0 = f[0];
|
|
364
|
+
i = f[1];
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
const p = pAt(w, i);
|
|
368
|
+
if (p) {
|
|
369
|
+
flush();
|
|
370
|
+
R.push({ punct: p[0] });
|
|
371
|
+
i = p[1];
|
|
372
|
+
start = end = base + i;
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
if (w[i] !== "‿") raw += w[i];
|
|
376
|
+
i++;
|
|
377
|
+
end = base + i;
|
|
378
|
+
}
|
|
379
|
+
return R;
|
|
380
|
+
}
|
|
381
|
+
function euSeg(t, base) {
|
|
382
|
+
return words(t, base, (w, o, ph) => {
|
|
383
|
+
const S = sylls(w, o),
|
|
384
|
+
N = S.filter((s) => !("punct" in s)).length;
|
|
385
|
+
let j = 0;
|
|
386
|
+
return S.map((s) => {
|
|
387
|
+
if ("punct" in s) return { kind: "punct", sym: s.punct, ph };
|
|
388
|
+
return { kind: "unit", ph, j: j++, nsyl: N, st: inStr(s.raw[0] ?? "", "ˈˌ") ? s.raw[0] : "", ...s };
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
// ---- Chinese (pinyin + tone digits; to be replaced with IPA + tone letters, D17)
|
|
393
|
+
function zhSeg(t, base) {
|
|
394
|
+
return words(t, base, (w, o, ph) =>
|
|
395
|
+
sylls(w, o).map((s) => {
|
|
396
|
+
if ("punct" in s) return { kind: "punct", sym: s.punct, ph };
|
|
397
|
+
const m = s.raw.match(/^[a-zü]+(\d)(?:>(\d))?/);
|
|
398
|
+
if (!m) throw new Error(`bad pinyin syllable ${JSON.stringify(s.raw)}`);
|
|
399
|
+
return { kind: "unit", ph, tone: m[2] || m[1], ...s };
|
|
400
|
+
}),
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=yomiscript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yomiscript.js","sourceRoot":"","sources":["../src/yomiscript.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,0HAA0H;AAC1H,0EAA0E;AAC1E,oHAAoH;AACpH,yGAAyG;AACzG,6GAA6G;AA4D7G,MAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,KAAK,IAAI,6BAA6B,EAAE,GAAG,CAAC,CAAC;AACpE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,IAAI,eAAe,EA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,KAAK,CAAC,CAAS,EAAE,IAAY;IACpC,OAAO,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CACjC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAS,EAAE;QAC3B,IAAI,OAAO,IAAI,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,CAAC;QAC7D,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAChD,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACxD,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/yomite.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Edit {
|
|
2
|
+
at: number;
|
|
3
|
+
ins: string;
|
|
4
|
+
del?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RealizeOptions {
|
|
7
|
+
dialect?: {
|
|
8
|
+
ja?: "tokyo" | "osaka";
|
|
9
|
+
};
|
|
10
|
+
/** only the Japanese accent phrases that carry ꜛ or ꜜ get values (and no devoicing is written); everything else is
|
|
11
|
+
* left to the Katarite's own prosody. For callers that mark the accent only where they know it (D25) */
|
|
12
|
+
markedOnly?: boolean;
|
|
13
|
+
/** multiplies the values written for Japanese (1 by default; 0.5 is the gentler pitch the tools use, D25) */
|
|
14
|
+
jaScale?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const f0Mark: (c: number[]) => string;
|
|
17
|
+
export declare function applyEdits(s: string, E: Edit[]): string;
|
|
18
|
+
export declare function realize(ys: string, opt?: RealizeOptions): string;
|
package/dist/yomite.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Yomite (reference, rule-based prosody): YomiScript with accent / stress / tone marks -> the same YomiScript with
|
|
2
|
+
// pitch values <f0:…> (semitones relative to the speaker's register) after each unit. Also writes allophones that are
|
|
3
|
+
// a pronunciation choice: Japanese vowel devoicing (◌̥) and the American English t/d flap (ɾ).
|
|
4
|
+
// Units that already carry <f0:…> are left as written. The Katarite renders only the values.
|
|
5
|
+
// Dialect is a Yomite setting, not part of YomiScript: realize(ys, {dialect:{ja:'osaka'}}).
|
|
6
|
+
import { parse, isJa, VOWELS } from "./yomiscript.js";
|
|
7
|
+
const inStr = (ch, s) => s.includes(ch);
|
|
8
|
+
const fmt = (v) => String(Math.round(v * 100) / 100);
|
|
9
|
+
export const f0Mark = (c) => `<f0:${c.map(fmt).join(",")}>`;
|
|
10
|
+
export function applyEdits(s, E) {
|
|
11
|
+
for (const e of [...E].sort((a, b) => b.at - a.at))
|
|
12
|
+
s = s.slice(0, e.at) + e.ins + s.slice(e.at + (e.del || 0));
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
// Japanese: Tokyo-type pitch from ꜛ / ꜜ per accent phrase. Osaka (Keihan-type): a phrase without ꜛ is high-onset,
|
|
16
|
+
// ꜛ marks where a low-onset phrase rises; the high stretch is flatter and vowels are not devoiced
|
|
17
|
+
const VLJ = ["k", "s", "ɕ", "t", "ʨ", "ʦ", "h", "ç", "ɸ", "p"];
|
|
18
|
+
const voicelessStart = (m) => !!m && m.mk === "mora" && VLJ.some((x) => (m.ipa ?? "").startsWith(x));
|
|
19
|
+
function devoiced(M, k, end) {
|
|
20
|
+
// i / ɯ between voiceless consonants, and the ɯ of a sentence-final す
|
|
21
|
+
const m = M[k];
|
|
22
|
+
if (m.mk !== "mora" || !inStr(m.v ?? "", "iɯɨ") || !voicelessStart(m))
|
|
23
|
+
return false;
|
|
24
|
+
if (voicelessStart(M[k + 1]))
|
|
25
|
+
return true;
|
|
26
|
+
return k === M.length - 1 && end === "$" && (m.ipa === "sɯ" || m.ipa === "sɨ");
|
|
27
|
+
}
|
|
28
|
+
function jaPhrase(M, end, E, { osaka, devoice, scale }) {
|
|
29
|
+
// one accent phrase: high after ꜛ (or from the start without ꜛ), low after ꜜ; declining within the high stretch
|
|
30
|
+
let state = M[0].hasRise ? "L" : "H", hk = 0;
|
|
31
|
+
M.forEach((m, k) => {
|
|
32
|
+
let v;
|
|
33
|
+
if (state === "H")
|
|
34
|
+
v = 2.5 - 0.45 * hk++;
|
|
35
|
+
else
|
|
36
|
+
v = k === 0 ? -2.0 : -2.5 - 0.3 * hk;
|
|
37
|
+
const auto = devoice && !osaka && devoiced(M, k, end);
|
|
38
|
+
if (auto && !m.dev)
|
|
39
|
+
E.push({ at: m.vend ?? 0, ins: "̥" });
|
|
40
|
+
if (osaka && v >= 0)
|
|
41
|
+
v = 2.5 - (2.5 - v) / 3;
|
|
42
|
+
if (!m.dev && !auto && !m.f0)
|
|
43
|
+
E.push({ at: m.end ?? 0, ins: f0Mark([v * scale]) });
|
|
44
|
+
if (m.rise)
|
|
45
|
+
state = "H";
|
|
46
|
+
if (m.fall)
|
|
47
|
+
state = "L";
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const marked = (M) => M.some((m) => m.rise || m.fall);
|
|
51
|
+
function jaRules(sec, E, opt) {
|
|
52
|
+
const C = [];
|
|
53
|
+
for (const t of sec.toks) {
|
|
54
|
+
if (t.kind !== "unit")
|
|
55
|
+
continue;
|
|
56
|
+
const c = t.chunk ?? 0;
|
|
57
|
+
C[c] ??= [];
|
|
58
|
+
C[c].push(t);
|
|
59
|
+
}
|
|
60
|
+
const o = { osaka: opt.dialect?.ja === "osaka", devoice: !opt.markedOnly, scale: opt.jaScale ?? 1 };
|
|
61
|
+
for (const M of C)
|
|
62
|
+
if (!opt.markedOnly || marked(M))
|
|
63
|
+
jaPhrase(M, sec.end, E, o);
|
|
64
|
+
}
|
|
65
|
+
// English / French: stress-based pitch, phrase-boundary rise, sentence-final fall or rise
|
|
66
|
+
function flaps(t, prev) {
|
|
67
|
+
// American English: t / d between a vowel (or r) and a vowel or syllabic l, not at the start of a word -> ɾ
|
|
68
|
+
const r = t.raw ?? "";
|
|
69
|
+
if (t.j === 0 || !inStr(r[0] ?? "#", "td") || r.length < 2 || prev?.kind !== "unit")
|
|
70
|
+
return false;
|
|
71
|
+
if (!inStr(r[1], VOWELS + "ɝɚ") && !r.slice(1).startsWith("l̩"))
|
|
72
|
+
return false;
|
|
73
|
+
return inStr((prev.raw ?? "").slice(-1), VOWELS + "ɹrɝɚ");
|
|
74
|
+
}
|
|
75
|
+
function euValue(t, fr) {
|
|
76
|
+
if (fr)
|
|
77
|
+
return t.j === (t.nsyl ?? 0) - 1 ? [0.5] : [-0.5];
|
|
78
|
+
return { ˈ: [3.0, 1.0], ˌ: [1.0] }[t.st ?? ""] ?? [-1.5];
|
|
79
|
+
}
|
|
80
|
+
// American English only: not en-GB, not French, and not English words inside another language
|
|
81
|
+
const flapping = (lang, top) => lang.startsWith("en") && lang !== "en-GB" && top.startsWith("en");
|
|
82
|
+
const lastValued = (C) => C.findLast((x) => x.c);
|
|
83
|
+
function euContours(sec, top, E) {
|
|
84
|
+
// stress-based value per syllable (null where the YomiScript already has one), plus the phrase-final rises
|
|
85
|
+
const fr = sec.lang === "fr", flap = flapping(sec.lang, top);
|
|
86
|
+
const C = [];
|
|
87
|
+
let prev = null;
|
|
88
|
+
for (const t of sec.toks) {
|
|
89
|
+
const L = t.kind === "bound" ? lastValued(C) : null;
|
|
90
|
+
if (L?.c)
|
|
91
|
+
L.c = [...L.c, 2.5];
|
|
92
|
+
if (t.kind === "bound")
|
|
93
|
+
continue;
|
|
94
|
+
if (t.kind === "unit" && flap && !t.f0 && flaps(t, prev))
|
|
95
|
+
E.push({ at: t.start ?? 0, del: 1, ins: "ɾ" });
|
|
96
|
+
if (t.kind === "unit")
|
|
97
|
+
C.push({ t, c: t.f0 ? null : euValue(t, fr) });
|
|
98
|
+
prev = t;
|
|
99
|
+
}
|
|
100
|
+
return C;
|
|
101
|
+
}
|
|
102
|
+
function euRules(sec, E, top) {
|
|
103
|
+
const C = euContours(sec, top, E), L = lastValued(C);
|
|
104
|
+
if (L?.c)
|
|
105
|
+
L.c = [L.c[0], sec.end === "$" ? -5 : 6]; // sentence-final fall or rise
|
|
106
|
+
for (const { t, c } of C)
|
|
107
|
+
if (c)
|
|
108
|
+
E.push({ at: t.end ?? 0, ins: f0Mark(c) });
|
|
109
|
+
}
|
|
110
|
+
// Chinese: tone contours (tone 5 = neutral, no value)
|
|
111
|
+
const TC = { 1: [3, 3], 2: [-1, 3.5], 3: [-3, -4.5, -3], 4: [4, -3], 5: null };
|
|
112
|
+
function zhRules(sec, E) {
|
|
113
|
+
for (const t of sec.toks) {
|
|
114
|
+
const c = TC[t.tone ?? ""];
|
|
115
|
+
if (t.kind === "unit" && !t.f0 && c)
|
|
116
|
+
E.push({ at: t.end ?? 0, ins: f0Mark(c) });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export function realize(ys, opt = {}) {
|
|
120
|
+
const Y = parse(ys), E = [];
|
|
121
|
+
for (const sec of Y.sections) {
|
|
122
|
+
if (isJa(sec.lang))
|
|
123
|
+
jaRules(sec, E, opt);
|
|
124
|
+
else if (opt.markedOnly)
|
|
125
|
+
continue;
|
|
126
|
+
else if (sec.lang === "zh")
|
|
127
|
+
zhRules(sec, E);
|
|
128
|
+
else
|
|
129
|
+
euRules(sec, E, Y.top);
|
|
130
|
+
}
|
|
131
|
+
return applyEdits(Y.ys, E);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=yomite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yomite.js","sourceRoot":"","sources":["../src/yomite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,EAAE,GAAG,CAAC,CAAC;aACpC,IAAI,GAAG,CAAC,UAAU;YAAE,SAAS;aAC7B,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;;YACvC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yomiscript/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "YomiScript: parser, types and the rule-based prosody (Yomite tools)",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/receptron/yomiscript.git",
|
|
9
|
+
"directory": "packages/core"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/receptron/yomiscript/tree/main/packages/core#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/receptron/yomiscript/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./node": {
|
|
22
|
+
"types": "./dist/node.d.ts",
|
|
23
|
+
"import": "./dist/node.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.json",
|
|
35
|
+
"prepack": "yarn --cwd ../.. build && node ../../tools/prepack.mjs"
|
|
36
|
+
}
|
|
37
|
+
}
|