1.3.0 • Published 3 months ago

@ssml-utilities/core v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

@ssml-utilities/core

SSMLユーティリティの中核機能を提供するパッケージです。SSML(Speech Synthesis Markup Language)の解析、DAG(有向非巡回グラフ)の構築、および基本的なユーティリティ機能を提供します。

インストール

npm install @ssml-utilities/core

または

pnpm add @ssml-utilities/core

主な機能

  • SSMLの解析
  • DAG(有向非巡回グラフ)の構築と操作
  • Result型を使用したエラーハンドリング

使用方法

SSMLの解析

import { parseSSML } from "@ssml-utilities/core";

const ssml = "<speak>Hello <emphasis>world</emphasis>!</speak>";
const result = parseSSML(ssml);

if (result.ok) {
  const dag = result.value;
  // DAGを使用した処理
}

DAGの操作

import { SSMLDAG } from "@ssml-utilities/core";

const dag = new SSMLDAG();
const nodeResult = dag.createNode("element", "speak", "<speak>");

if (nodeResult.ok) {
  const node = nodeResult.value;
  // ノードを使用した処理
}

API

DAGNode型

DAGのノードを表す型です:

interface DAGNode {
  id: string;
  type: "root" | "element" | "text" | "attribute";
  name?: string;
  value?: string;
  children: Set<string>;
  parents: Set<string>;
}

Result型

エラーハンドリングのための型を提供します:

type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };

デバッグ

DAGの構造を確認するためのデバッグ機能を提供しています:

import { debugParseSSML } from "@ssml-utilities/core";

const debug = debugParseSSML("<speak>Hello, world!</speak>");
console.log(debug); // DAG構造を表示

ライセンス

MITライセンスの下で公開されています。詳細はLICENSEファイルを参照してください。

関連パッケージ

1.2.0

7 months ago

1.1.0

8 months ago

1.2.7

4 months ago

1.2.6

4 months ago

1.2.3

6 months ago

1.2.2

6 months ago

1.3.0

3 months ago

1.2.1

7 months ago

1.0.0

9 months ago