jovo-plugin-speechmarkdown
v2.2.0
Published
A Jovo Framework plugin for Speech Markdown
Downloads
6
Readme
jovo-plugin-speechmarkdown
Platforms
The following platforms are supported:
- [x] Amazon Alexa
- [x] Google Assistant
- [x] Samsung Bixby
Install
Install SpeechMarkdown plugin into your Jovo project:
npm install jovo-plugin-speechmarkdown --save
Use the plugin in the app.js:
const { SpeechMarkdown } = require('jovo-plugin-speechmarkdown');
app.use(
// ... base imports
new SpeechMarkdown()
);
Or app.ts:
import { SpeechMarkdown } from 'jovo-plugin-speechmarkdown';
app.use(
// ... base imports
new SpeechMarkdown()
);
Usage
Tell:
this.tell('Sample [3s] speech [250ms] markdown');
Ask:
this.ask('Sample [3s] speech [250ms] markdown', 'reprompt [250ms] markdown');
In general:
const speechMarkdownSSML = this.$speechMarkdown.toSSML('Sample [3s] speech [250ms] markdown');
Configuration
Add the plugin configuration to the project's config.js
file:
plugin: {
SpeechMarkdown: {
includeFormatterComment: false,
includeParagraphTag: false,
includeSpeakTag: true,
preserveEmptyLines: true,
voices: {
Brian: { voice: { name: Joey } },
Sarah: { voice: { name: Kendra } }
}
}
}
In this config, Alexa-specific names are used for the voices and are assigned to custom names Brian and Sarah. For Google Assistant, a mapping happens for the Alexa names to corresponding voice tags on Google.
The plugin also supports platform-specific overrides for 'amazon-alexa', 'google-assistant' and 'samsung-bixby':
plugin: {
SpeechMarkdown: {
includeFormatterComment: false,
includeParagraphTag: false,
'amazon-alexa': {
voices: {
Brian: { voice: { name: Joey } },
Sarah: { voice: { name: Kendra } }
}
},
'google-assistant': {
voices: {
Brian: { voice: { gender: male, variant: 1, language: en - US } },
Sarah: { voice: { gender: female, variant: 3, language: en - US } }
}
}
}
}
Any root-level options are treated as defaults and any platform-specific options are merged with the defaults and overrides any properties with matching keys.