Skip to content

ghyman-oreilly/markdown-to-ssml-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markdown-to-ssml-converter

A package for converting 'speech markdown' flavor of markdown to SSML, with service-specific formatters.

Installation and setup

  1. Clone down the repo and cd into the project root.

  2. Install dependencies: pip install -r requirements.txt

  3. Run the sample main.py script:

    python main.py <path_to_markdown_file> [--output-dir] [--voice]

    Or modify the script to meet your needs.

  4. Running the sample script will produce an SSML-formatted XML file from your Markdown file.

Script options

  • --output-dir: Set a custom output directory. Defaults to ./data.
  • --voice: Set a custom voice (for use with the Azure formatter). Options: cora, adam, nancy, emma, jane, jason, davis, samuel. Default: jane.

Modules

  • ssml_extention.py: Classes for extending python-markdown parser, to handle speech markdown conventions.
  • formatters.py: Formatters for aligning SSML with requirements of specific cloud-service providers. Currently includes a formatter for Azure only.
  • validators.py: Function for validating base SSML against W3C schema. Schemas are saved locally in the project /assets folder.

Dependencies/Requirements

  • elementpath==4.8.0
  • Markdown==3.8
  • xmlschema==4.0.1
  • Tested with Python 3.13.3

Limitations

Speech Markdown parsing support is currently limited to:

  • sub: (text)[sub:"value"]
  • emphasis: (text)[emphasis:"level"]; levels: reduced, medium, strong
  • say-as: (text)[say-as:"value"]; values: cardinal, ordinal, characters
  • ipa: (text)[ipa:"value"]; values: string using IPA; see IPA resources
  • break: text [break: "250ms"] text
  • prosody: WIP, untested

Resources

And a huge thank you to Andy Barrett-Sprot, whose awesome markdown-to-ssml mistune renderer inspired the SSMLTreeprocessor in markdown-to-ssml-converter.

About

Package for converting 'speech markdown' flavor of markdown to SSML, with service-specific formatters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages