JargonInc / jargon-sdk-nodejs

Multi-package repo for Jargon's nodejs SDKs
Apache License 2.0
13 stars 1 forks source link

Is it possible to use Jargon with APL speech? #13

Open TheDreamSaver opened 4 years ago

TheDreamSaver commented 4 years ago

Is it possible to use Jargon with APL speech? https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/apl-speech-and-text-synchronization-for-text-blocks.html

jonburs commented 4 years ago

There are a couple of approaches you can use for APL with the Jargon SDK. Both of them make use of the ResourceManager interface (https://github.com/JargonInc/jargon-sdk-nodejs/tree/master/packages/alexa-skill-sdk#resourcemanager).

The first approach is to use renderString to obtain specific speech items, and place those items within the appropriate fields of the data source you bind to the APL document.

The second approach is to use renderObject to construct the entire data source object (and conceivably the APL document as well).

Both methods work equally well -- the choice depends on how much of the APL data you wish to have managed via the Jargon SDK. The renderString approach can minimize duplication of data that's the same across locales, but can require more code depending on how many strings you're adding.