Skip to content

SSMLVerifier will verify that a given input is valid SSML

License

Notifications You must be signed in to change notification settings

janniksam/SSMLVerifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSMLVerifier

SSMLVerifier will verify that a given input is valid SSML. It is based of a javascript implementation found here: https://github.com/gsdriver/ssml-check

Build status master NuGet version

WIP

This is a WIP project. Here is the current state of the implementation:

Common tags:

  • #049b2c audio
  • #049b2c break
  • #049b2c emphasis
  • #049b2c p
  • #049b2c prosody
  • #049b2c s
  • #049b2c say-as
  • #049b2c speak
  • #049b2c sub

Amazon tags:

  • #049b2c amazon:domain
  • #049b2c amazon:effect
  • #049b2c amazon:emotion
  • #049b2c lang
  • #049b2c phoneme
  • #c5f015 voice
  • #049b2c w

Google tags:

  • #049b2c par
  • #049b2c seq
  • #049b2c media
  • #049b2c desc

Basic usage

The basic usage looks like this:

const string testSsml = "<speak>Hello <break strength='weak' time='1s'/> World!</speak>";
var verifier = new Verifer();
var errors = verifier.Verify(testSsml);
if(errors.Count() == 0)
{
   Console.WriteLine("SSML is valid!");
}
else
{
   foreach(var error in errors)
   {
      Console.WriteLine(error.Error);
   }
}

But I'd recommend you to use the second parameter aswell, which sets the target platform.

verifier.Verify(testSsml, SsmlPlatform.Amazon);
// or ...
verifier.Verify(testSsml, SsmlPlatform.Google);

This way you are able to use platform specific tags like Amazon's lang-tag

// lang is an amazon-specific tag
const string testSsml = "<speak>Hello <lang xml:lang='de-DE'>Welt</lang></speak>";
var verifier = new Verifer();
// this will fail, because lang is a Amazon-specific tag
var result = verifier.Verify(testSsml, SsmlPlatform.Google);