In order to ease the integration of dynamic grammars hosted on NuGram Hosted Server, the NuGram team has developed client APIs in a variety of programming languages. The code is available on Github, but a zip file can be downloaded directly from the NuGram web site.
Supported languages/systems are currently:
- Python 2.5/2.6 and Jython 2.5
- pure VoiceXML 2.1
And there are more to come.
Using these APIs, it becomes really easy to create dynamically-generated grammars for use by your favorite hosted communication platform (be it a VoiceXML platform or one of the many new API-based platforms), or compute the semantic interpretation of a textual sentencehe following grammar template.
Suppose we’d like to implement a simple voice dialing application. A dynamic grammar template (called
voicedialer.abnf) for this application would look like the following:
To get a valid recognition grammar from this template, we need to provide data to the template engine (in this case the contact list) to fill in the blanks using call-specific information. This is called instantiating the dynamic grammar.
So to instantiate the template above and retrieve the URL for the SRGS XML representation of the generated grammar in Ruby, only four lines of code are needed:
As can be seen in this example, data used by the templating engine to create the resulting grammar is specified using native data structures of the host language (Ruby dictionaries/hashmaps in this case).