Is it possible to use dynamic grammars with Audium? How could I use an element that uses a grammar whose entries are based on a database fetch?
For example, let's we have an application that would look like this
System: "What do you want to buy?" User: "<something>" database fetch to obtain available colors for item <something> System: "Ok, we have this item in blue, red or black. What color do you want?"
In that case we would want to build a grammar with items "blue", "red" and "black" as well as the concatenation of their associated sound files.
Sure, dynamic grammars are supported in Audium. here is one way you can use them:
Use the Form element and specify in the setting for the grammar a URL using substitution to pass arguments. You would make a Form or menu or something where they enter the item. The value associated with that item in the grammar is saved to Element Data. You then make a JSP, ASP or whatever take as input an item as an HTTP argument and it returns a grammar listing all the colors. You then use substitution in the Form element settings to pass the URL to that JSP with the item as an argument.
Lets say the element that captured the item was named "getItem" and it was a Form element. The setting would look something like this:
You then write your JSP to access the database, get the colors, and return a grammar of the appropriate format containing the information known only from the input argument.
You can use the same concept to pass any number of arguments you wish.
Now, if you prefer to have the database lookup done within Audium, you could take a similar approach but instead of passing the item, you pass the colors as input to the script (though it seems pointless to do this unless you plan on putting in natural language processing into the grammar). So you would make the grammar URL:
green or something like this.
Yet another possibility would be to dynamically create an inline grammar by specifying a Java class or UTI using the XML API to dynamically configure a Form element to contain a separate setting value for each color.
I'd like to have more input about how I could build an inline grammar from some Java code. Is it the same way then JSP/ASP (pointing to an URL, in this case the grammar would be generated by a Java Servlet) or is there a way to do this by extending a specific Audium class or using a special Audium element?
Also, how about prompt concatenation? (with a dynamic number of prompts, in our exemple we had 3 colors, but it can be 2 colors, or 4, or...)
There are a number of ways to create the functionality you describe including those mentioned in the previous post. If you do not want to write your own jsp/asp to dynamically create the grammar, you can use a dynamic element configuration using the api (java or xml over http) provided by Audium. This will let you configure both application settings and audio groups at runtime when the element is reached. This should handle your requirement for the dynamic grammar and dynamic number of prompts. More detail on dynamic element configurations is in the User Guide - Chapter 3. Also, Tutorial application 3 (AudiumClock) provides a sample application that uses a dynamic configuration.
I would like to add that specifically, you could use the Form element with a dynamic configuration to set the "Voice Keyword" setting values in order to set inline grammar at runtime.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: