ssml-builder-js 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/{chunk-QJTVHANI.mjs → chunk-4RQETJUI.mjs} +1 -1
- package/dist/chunk-4RQETJUI.mjs.map +1 -0
- package/dist/{chunk-D6ITDU3A.mjs → chunk-TKD3PU5Y.mjs} +28 -5
- package/dist/chunk-TKD3PU5Y.mjs.map +1 -0
- package/dist/core.d.mts +3 -1
- package/dist/core.d.ts +3 -1
- package/dist/core.js +27 -4
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/elements.js.map +1 -1
- package/dist/elements.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-D6ITDU3A.mjs.map +0 -1
- package/dist/chunk-QJTVHANI.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ const parsed = parseSsml(ssml);
|
|
|
136
136
|
| `validateSsml(xml)` | SSML の構文エラーを `{ message, position }` または `null` で返す |
|
|
137
137
|
| `extractSsmlText(xml)` | タグを除いた全テキストノードを文書順に抽出 |
|
|
138
138
|
| `mapSsmlTextNodes(xml, transform, options?)` | タグ構造を維持したままテキストノードだけを同期・非同期変換。スキップタグとコンテキストフィルターに対応 |
|
|
139
|
-
| `validateAzureSsml(xml, options?)` | Azure Speech 向けの意味検証結果を Diagnostic
|
|
139
|
+
| `validateAzureSsml(xml, options?)` | Azure Speech 向けの意味検証結果を Diagnostic 配列で返す(各診断に `source: "ssml-static-validator"` を付与) |
|
|
140
140
|
|
|
141
141
|
### 3段階の検証モデル
|
|
142
142
|
|
|
@@ -150,6 +150,8 @@ SSML の検証は、構文、Azure 固有の静的な意味、実サービスの
|
|
|
150
150
|
|
|
151
151
|
`voice`、`prosody`、`break`、`express-as`、`say-as`、`phoneme`、`audio`、`lang`、`mark` などの要素を型付きで表現できます。`type: "custom"` と `name` を指定すれば、未定義の XML 要素や追加属性も扱えます。`mstts:` 要素を含むドキュメントを生成すると、必要な Azure Speech 名前空間が自動的に追加されます。
|
|
152
152
|
|
|
153
|
+
`validateAzureSsml` は Azure Speech へ送信する前に実行する事前静的チェックです。返却される診断の `source` はパッケージ側の静的解析結果であることを示し、Azure Speech サービス側でのランタイム生成結果や実際の合成可否を表すものではありません。
|
|
154
|
+
|
|
153
155
|
翻訳などで本文だけを置き換える場合は、`mapSsmlTextNodes` に変換関数を渡します。変換関数には直近の親タグと祖先タグの `path` が渡され、戻り値は `string` または `Promise<string>` を指定できます。`validateAzureSsml` は音声、属性値、音声スタイル、文字数、`audio` URL/オリジンを検証します。
|
|
154
156
|
|
|
155
157
|
`mapSsmlTextNodes` の第 3 引数で、翻訳対象外タグとコンテキストフィルターを指定できます。デフォルトでは `phoneme`、`say-as`、`sub` の本文を変換しません。`filter` には `parentTag`、`parentAttributes`、`ancestorTags`、`path` が渡されます。
|
|
@@ -542,7 +544,7 @@ The main `buildSsml` and `parseSsml` signatures are:
|
|
|
542
544
|
| `validateSsml(xml)` | Returns `{ message, position }` for a syntax error, or `null` |
|
|
543
545
|
| `extractSsmlText(xml)` | Extracts all text nodes in document order |
|
|
544
546
|
| `mapSsmlTextNodes(xml, transform, options?)` | Transforms only text nodes while preserving the XML structure; supports sync/async transforms, skipped tags, and context filters |
|
|
545
|
-
| `validateAzureSsml(xml, options?)` | Returns Azure Speech semantic-validation diagnostics |
|
|
547
|
+
| `validateAzureSsml(xml, options?)` | Returns Azure Speech semantic-validation diagnostics (each diagnostic has `source: "ssml-static-validator"`) |
|
|
546
548
|
|
|
547
549
|
### Three-stage validation model
|
|
548
550
|
|
|
@@ -556,6 +558,8 @@ SSML validation separates XML syntax, Azure-specific static semantics, and runti
|
|
|
556
558
|
|
|
557
559
|
Typed representations are available for elements such as `voice`, `prosody`, `break`, `express-as`, `say-as`, `phoneme`, `audio`, `lang`, and `mark`. Use `type: "custom"` and `name` to handle undefined XML elements or additional attributes. When a document contains `mstts:` elements, the required Azure Speech namespace is added automatically.
|
|
558
560
|
|
|
561
|
+
`validateAzureSsml` is a preflight static check performed by this package before sending SSML to Azure Speech. The `source` on each returned diagnostic identifies package-side static analysis; it is independent of Azure Speech's runtime generation result and does not guarantee that synthesis will succeed.
|
|
562
|
+
|
|
559
563
|
Use `mapSsmlTextNodes` to replace translatable content without changing tags, attributes, or nesting. The transform receives the immediate parent tag and ancestor `path`, and may return a `string` or a `Promise<string>`. The third argument supports `skipTags` and a `filter` callback; `phoneme`, `say-as`, and `sub` are skipped by default. The callback receives `parentTag`, decoded `parentAttributes`, `ancestorTags`, and `path`.
|
|
560
564
|
|
|
561
565
|
```ts
|