SpeechMarkdown parser - convert SpeechMarkdown to SSML
Project description
SpeechMarkdown Rust
High-performance SpeechMarkdown parser written in Rust. Converts SpeechMarkdown syntax to platform-specific SSML for Amazon Alexa, Google Assistant, Microsoft Azure, and more.
Usage
Rust
use speechmarkdown_rust::{SpeechMarkdownParser, Platform};
// Convert to SSML
let ssml = SpeechMarkdownParser::to_ssml(
"Hello (world)[emphasis:\"strong\"]",
Platform::AmazonAlexa,
)?;
// => <speak>Hello <emphasis level="strong">world</emphasis></speak>
// Convert to plain text
let text = SpeechMarkdownParser::to_text("Hello (world)[emphasis:\"strong\"]")?;
// => Hello world
// Parse to AST (JSON)
let ast = SpeechMarkdownParser::parse("Hello world")?;
Supported Platforms
| Platform | Enum Value | String ID |
|---|---|---|
| Amazon Alexa | Platform::AmazonAlexa |
"amazon-alexa" or "alexa" |
| Google Assistant | Platform::GoogleAssistant |
"google-assistant" or "google" |
| Microsoft Azure | Platform::MicrosoftAzure |
"microsoft-azure" or "azure" |
| Apple | Platform::Apple |
"apple" |
| W3C | Platform::W3c |
"w3c" |
| Samsung Bixby | Platform::SamsungBixby |
"samsung-bixby" or "bixby" |
| ElevenLabs | Platform::ElevenLabs |
"elevenlabs" |
| IBM Watson | Platform::IbmWatson |
"ibm-watson" or "watson" |
Language Bindings
The library exposes a C ABI (cdylib/staticlib) so it can be used from any language. Pre-built bindings are provided for .NET, Swift, and Node.js.
Build the native library
cargo build --release
This produces:
- Windows:
target/release/speechmarkdown_rust.dll - macOS:
target/release/libspeechmarkdown_rust.dylib - Linux:
target/release/libspeechmarkdown_rust.so
C API
#include "bindings/speechmarkdown.h"
// Convert SpeechMarkdown to SSML
const char* ssml = speechmarkdown_to_ssml("Hello (world)[emphasis:\"strong\"]", "amazon-alexa");
printf("%s\n", ssml);
speechmarkdown_free((char*)ssml);
// Convert to plain text
const char* text = speechmarkdown_to_text("Hello (world)[emphasis:\"strong\"]");
printf("%s\n", text);
speechmarkdown_free((char*)text);
// Get last error (thread-local)
const char* err = speechmarkdown_get_error();
.NET (C#)
using SpeechMarkdown;
var parser = new SpeechMarkdownParser();
string ssml = parser.ToSsml("Hello (world)[emphasis:\"strong\"]", Platform.AmazonAlexa);
string text = parser.ToText("Hello (world)[emphasis:\"strong\"]");
string json = parser.ParseToJson("Hello world");
Copy bindings/dotnet/SpeechMarkdown.cs into your project and place the native library in your output directory alongside the assembly.
Swift
import SpeechMarkdown
let parser = SpeechMarkdownParser()
let ssml = try parser.toSsml(input: "Hello (world)[emphasis:\"strong\"]", platform: "amazon-alexa")
let text = try parser.toText(input: "Hello (world)[emphasis:\"strong\"]")
let json = try parser.parseToJson(input: "Hello world")
Include bindings/swift/SpeechMarkdown.swift, bindings/swift/module.modulemap, and bindings/speechmarkdown.h in your Xcode project. Link against the compiled .dylib.
Node.js
const { SpeechMarkdownParser } = require('./bindings/nodejs');
const parser = new SpeechMarkdownParser();
const ssml = parser.toSsml('Hello (world)[emphasis:"strong"]', 'amazon-alexa');
const text = parser.toText('Hello (world)[emphasis:"strong"]');
const json = parser.parseToJson('Hello world');
Install ffi-napi and ref-napi as dependencies. Build the native library first with cargo build --release.
Python
from speechmarkdown import to_ssml, to_text, parse
ssml = to_ssml('Hello (world)[emphasis:"strong"]', 'amazon-alexa')
text = to_text('Hello (world)[emphasis:"strong"]')
ast = parse('Hello world') # returns dict
Available on PyPI as speechmarkdown-rust.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speechmarkdown_rust-0.1.12.tar.gz.
File metadata
- Download URL: speechmarkdown_rust-0.1.12.tar.gz
- Upload date:
- Size: 449.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d42041af83eaa20ca6ac77466f4a25803e03b20918b0204358cf72d47434a4fb
|
|
| MD5 |
66a38c626853215c8719f9bb441fb808
|
|
| BLAKE2b-256 |
78a0d65b3934c2b9223f77723356c690a0108a48e3ed9d1de8a89f669cfe625e
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12.tar.gz:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12.tar.gz -
Subject digest:
d42041af83eaa20ca6ac77466f4a25803e03b20918b0204358cf72d47434a4fb - Sigstore transparency entry: 1602054871
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.12-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.12-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 221.7 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da8718cd9f4b5876f849b105baa0dae3f4109843c571696190a56a4bc173232b
|
|
| MD5 |
132f1b38c67e5e863d177a1e3afe1122
|
|
| BLAKE2b-256 |
31fd34ed35575ba8efb586c3702a4ec5d9091592d3dfdca19b988bec18df0f15
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12-cp313-cp313-win_amd64.whl:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12-cp313-cp313-win_amd64.whl -
Subject digest:
da8718cd9f4b5876f849b105baa0dae3f4109843c571696190a56a4bc173232b - Sigstore transparency entry: 1602054875
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 360.2 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d30ae802b15a81a18c1cd6d32fd1b26539b0b523cb8a573226adce0b292ecdf6
|
|
| MD5 |
8b83570ebdc6930f7bb42ea479383af9
|
|
| BLAKE2b-256 |
e4be9edcb432b1f5adbe62a70a4b14bf0fd99fd8171a90eaf384dd41f88f637d
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d30ae802b15a81a18c1cd6d32fd1b26539b0b523cb8a573226adce0b292ecdf6 - Sigstore transparency entry: 1602054885
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 351.6 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3517cc68316fbd9df6c2615151cf8f01c221b211252ddb66c4a932a1cb32dc0c
|
|
| MD5 |
2b2360b281d3c5406df653751d4b0009
|
|
| BLAKE2b-256 |
eed4a83f12fd451032704ad1ae28cca19f014deef924183da7741954c3e1a669
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
3517cc68316fbd9df6c2615151cf8f01c221b211252ddb66c4a932a1cb32dc0c - Sigstore transparency entry: 1602054904
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.12-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.12-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 317.3 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd792ded9da1d62552b65b0a284280053f0bbab84fcfe9bb842f7a39dea02ee7
|
|
| MD5 |
d7edd0cb7df8921450b2ef2bfcfdf76a
|
|
| BLAKE2b-256 |
c16ca510465dc30c5f667079fb70c833d6fa82f6b0e991667953771e262a6bf0
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12-cp313-cp313-macosx_11_0_arm64.whl:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
bd792ded9da1d62552b65b0a284280053f0bbab84fcfe9bb842f7a39dea02ee7 - Sigstore transparency entry: 1602054891
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.12-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.12-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 323.7 kB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3374549bc46cf62b9798b8145a6ee4ba47f0648e453bb73f0bc3a8a172004fff
|
|
| MD5 |
14a497e3da09be28b3ad5b257b8269b7
|
|
| BLAKE2b-256 |
b0af9fd13f3b1d1643170bfd4b849bfbc65eef32f2129cd508b78d7f60a4fee9
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.12-cp313-cp313-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on AACTools/speechmarkdown-rust
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechmarkdown_rust-0.1.12-cp313-cp313-macosx_10_12_x86_64.whl -
Subject digest:
3374549bc46cf62b9798b8145a6ee4ba47f0648e453bb73f0bc3a8a172004fff - Sigstore transparency entry: 1602054878
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@733a6a2108fb08f6919a074c51476d0f171b81fc -
Branch / Tag:
refs/tags/v0.1.12 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@733a6a2108fb08f6919a074c51476d0f171b81fc -
Trigger Event:
push
-
Statement type: