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.
Install
| Language | Package | Install |
|---|---|---|
| Rust | speechmarkdown-rust | cargo add speechmarkdown-rust |
| Python | speechmarkdown-rust | pip install speechmarkdown-rust |
| Node.js | speechmarkdown | npm install speechmarkdown |
| .NET | SpeechMarkdown | dotnet add package SpeechMarkdown |
Supported Platforms
| Platform | String ID |
|---|---|
| Amazon Alexa | "amazon-alexa" or "alexa" |
| Google Assistant | "google-assistant" or "google" |
| Microsoft Azure | "microsoft-azure" or "azure" |
| Apple | "apple" |
| W3C | "w3c" |
| Samsung Bixby | "samsung-bixby" or "bixby" |
| ElevenLabs | "elevenlabs" |
| IBM Watson | "ibm-watson" or "watson" |
API
All bindings expose the same core methods:
| Method | Returns | Description |
|---|---|---|
to_ssml(input, platform) |
string |
Convert SpeechMarkdown to SSML for the given platform |
to_text(input) |
string |
Convert SpeechMarkdown to plain text (strips all markup) |
parse(input) |
string (JSON) |
Parse SpeechMarkdown and return the AST as JSON |
is_speech_markdown(input) |
bool |
Check if a string contains SpeechMarkdown syntax |
validate(input) |
bool |
Validate that SpeechMarkdown parses without errors |
Usage
Rust
use speechmarkdown_rust::{SpeechMarkdownParser, Platform};
// Convert to SSML
let ssml = SpeechMarkdownParser::to_ssml(
"Hello (world)[emphasis:\"strong\"]",
Platform::AmazonAlexa,
)?;
// Convert to plain text
let text = SpeechMarkdownParser::to_text("Hello (world)[emphasis:\"strong\"]")?;
// Parse to AST (JSON string)
let ast = SpeechMarkdownParser::parse("Hello world")?;
// Check if input contains SpeechMarkdown syntax
if SpeechMarkdownParser::is_speech_markdown(&input) {
// ...
}
// Validate input
SpeechMarkdownParser::validate(&input)?;
Python
from speechmarkdown_rust import to_ssml, to_text, parse, is_speech_markdown, validate
ssml = to_ssml('Hello (world)[emphasis:"strong"]', 'amazon-alexa')
text = to_text('Hello (world)[emphasis:"strong"]')
ast = parse('Hello world')
is_smd = is_speech_markdown('Hello (world)[emphasis:"strong"]') # True
is_smd = is_speech_markdown('Hello world') # False
validate('Hello (world)[emphasis:"strong"]') # raises ValueError if invalid
Node.js
const { to_ssml, to_text, parse, is_speech_markdown, validate } = require('speechmarkdown')
const ssml = to_ssml('Hello (world)[emphasis:"strong"]', 'amazon-alexa')
const text = to_text('Hello (world)[emphasis:"strong"]')
const ast = parse('Hello world')
is_speech_markdown('Hello (world)[emphasis:"strong"]') // true
is_speech_markdown('Hello world') // false
validate('Hello (world)[emphasis:"strong"]') // throws if invalid
.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");
bool isSmd = parser.IsSpeechMarkdown("Hello (world)[emphasis:\"strong\"]"); // true
parser.Validate("Hello (world)[emphasis:\"strong\"]"); // throws on invalid
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")
let isSmd = parser.isSpeechMarkdown(input: "Hello (world)[emphasis:\"strong\"]") // true
try parser.validate(input: "Hello (world)[emphasis:\"strong\"]") // throws on invalid
C API
#include "speechmarkdown.h"
// Convert to SSML
const char* ssml = speechmarkdown_to_ssml("Hello (world)[emphasis:\"strong\"]", "amazon-alexa");
speechmarkdown_free((char*)ssml);
// Convert to plain text
const char* text = speechmarkdown_to_text("Hello (world)[emphasis:\"strong\"]");
speechmarkdown_free((char*)text);
// Parse to JSON
const char* json = speechmarkdown_parse("Hello world");
speechmarkdown_free((char*)json);
// Check for SpeechMarkdown syntax
bool is_smd = speechmarkdown_is_speech_markdown("Hello (world)[emphasis:\"strong\"]");
// Validate
bool valid = speechmarkdown_validate("Hello (world)[emphasis:\"strong\"]");
// Get last error (thread-local)
const char* err = speechmarkdown_get_error();
Building from Source
cargo build --release
This produces:
- Windows:
target/release/speechmarkdown_rust.dll - macOS:
target/release/libspeechmarkdown_rust.dylib - Linux:
target/release/libspeechmarkdown_rust.so
License
MIT
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.13.tar.gz.
File metadata
- Download URL: speechmarkdown_rust-0.1.13.tar.gz
- Upload date:
- Size: 452.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
940b72b97733f4d19feec39d13bcababc405c6542f44162a6df7c626e8b2f467
|
|
| MD5 |
d7384011d20bce758939876698d21095
|
|
| BLAKE2b-256 |
e9fab521cf0f07ea905e5665c5e28be23a5ad657a25b13896bfb94c54a0e50aa
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13.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.13.tar.gz -
Subject digest:
940b72b97733f4d19feec39d13bcababc405c6542f44162a6df7c626e8b2f467 - Sigstore transparency entry: 1602128026
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.13-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.13-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 223.4 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 |
76044eb9f8049888d186740161b047ec6275f1476c9ed0b5abcc9ea0a6566236
|
|
| MD5 |
b39e7f4735ac22fa63a1548df5e3dcb1
|
|
| BLAKE2b-256 |
6d80b1e41a921a8827c789cf76f8ef7fe2d9171ef80678a898c27cf831aaa317
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13-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.13-cp313-cp313-win_amd64.whl -
Subject digest:
76044eb9f8049888d186740161b047ec6275f1476c9ed0b5abcc9ea0a6566236 - Sigstore transparency entry: 1602128057
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 362.9 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 |
7800684ae895f51195d3231265f0acf0fcb7fc61be9ba528f279349c44e8f2d9
|
|
| MD5 |
3c6ff33b9b54cbb30ce6236e526c5cff
|
|
| BLAKE2b-256 |
928a639d5c5c89829f9ce2ab004bf9be7f33941af56be0e7c0b074529cc8433b
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13-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.13-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
7800684ae895f51195d3231265f0acf0fcb7fc61be9ba528f279349c44e8f2d9 - Sigstore transparency entry: 1602128067
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.13-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.13-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 354.2 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 |
534ef90b7e63b70fb46683ad4d25f8422c34689b0a03db8cf2a922287f1e5a30
|
|
| MD5 |
a74ee9405b1964068420e7f98bd63036
|
|
| BLAKE2b-256 |
a09dabb5d0c04991da440dc2c0a67b341e04685e718225dfb9e1f3a2da5fac59
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13-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.13-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
534ef90b7e63b70fb46683ad4d25f8422c34689b0a03db8cf2a922287f1e5a30 - Sigstore transparency entry: 1602128036
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.13-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.13-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 319.6 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 |
6202a7ba7e06a1e8c812ce59b53062a6bbd6e173f265b5fe565d0240248dc9f5
|
|
| MD5 |
dcf427800d85fff97ce6439a1ce77050
|
|
| BLAKE2b-256 |
252d1aa60ae2ef90670c97cca0c36ffdf4265f6ad1584c4b17fa879f23bc825d
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13-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.13-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
6202a7ba7e06a1e8c812ce59b53062a6bbd6e173f265b5fe565d0240248dc9f5 - Sigstore transparency entry: 1602128072
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechmarkdown_rust-0.1.13-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: speechmarkdown_rust-0.1.13-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 325.4 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 |
ae87dc2714cbe8376bcb047ee845208bc8c3131f7a37f2622b7321b733629fe9
|
|
| MD5 |
28462ed5b7a6a2f2639504772b6fa09b
|
|
| BLAKE2b-256 |
da280697bae67e5c12642b26ffa0fb98c9aaef5c474ff127eae8b3cfa7428841
|
Provenance
The following attestation bundles were made for speechmarkdown_rust-0.1.13-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.13-cp313-cp313-macosx_10_12_x86_64.whl -
Subject digest:
ae87dc2714cbe8376bcb047ee845208bc8c3131f7a37f2622b7321b733629fe9 - Sigstore transparency entry: 1602128049
- Sigstore integration time:
-
Permalink:
AACTools/speechmarkdown-rust@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Branch / Tag:
refs/tags/v0.1.13 - Owner: https://github.com/AACTools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@081d62e76edfafbb12deeb5d4c77a2fbed72d469 -
Trigger Event:
push
-
Statement type: