More Related Content Similar to The NuGram approach to dynamic grammars (20) The NuGram approach to dynamic grammars2. Introduction What is a dynamic grammar? A grammar whose content is not known in advance Content comes from an external source Database Excel sheet Web service Data collected during the call Etc. Copyright © 2010 Nu Echo Inc. 3. Introduction Why dynamic grammars? Grammar content is only known at run-time To constrain grammars in order to improve recognition accuracy To solve maintenance problems More details on our blog: http://blog.nuecho.com/2008/10/06/use-cases-for-dynamic-grammars/ http://blog.nuecho.com/2008/10/09/use-cases-for-dynamic-grammars-part-2/ Copyright © 2010 Nu Echo Inc. 4. Use Cases On-the-fly generation Content comes from call-specific data Examples Identity validation Address capture Voice dialing Personalized bill payee list Personalized menu options One-step correction Copyright © 2010 Nu Echo Inc. 5. Use Cases Offline generation (triggered) Results from an external event Examples: Auto-attendant Movie listings Copyright © 2010 Nu Echo Inc. 6. Use Cases Offline generation (scheduled) Grammar generation is part of a scheduled maintenance process Examples Phone numbers (area code may be added) Postal/Zip codes Stock quotes, mutual funds Bill payee list management Copyright © 2010 Nu Echo Inc. 7. Use Cases Offline generation (build time) For grammars based on company-specific data Usually requires scheduled maintenance process Examples Branch names and addresses Stock quotes, mutual funds Bill payee list management Copyright © 2010 Nu Echo Inc. 9. The Generation Process ABNF Grammar Template Grammar GSL Instantiation context GrXML Copyright © 2010 Nu Echo Inc. 10. Start with an ABNF grammar #ABNF 1.0 ISO-8859-1; languageen-US; root$name; public$name= [$pre_filler] $employeeName[$post_filler]; $employeeName= [dominique] boucher; Copyright © 2010 Nu Echo Inc. 11. Add dynamic directives #ABNF 1.0 ISO-8859-1; language@string callerLanguage; root$name; public$name= [$pre_filler] $employeeName[$post_filler]; $employeeName = [@word employee.firstname] @word employee.lastname; Copyright © 2010 Nu Echo Inc. 12. Complex objects and control-flow $employeeName = @alt @for(entry : entries) @if(entry.isDepartment) @word entry.name @else ([@word entry.firstname] @word entry.lastname @end @end @end ; Copyright © 2010 Nu Echo Inc. 13. NuGram Server Runtime infrastructure to deploy dynamic grammars Java Servlettechnology Can run in parallel/be packaged with your application Outputs grammars in ABNF, GrXML, GSL Fine-grained control of caching strategy Using configuration or Java API Two sets of APIs JSP-like API REST API Copyright © 2010 Nu Echo Inc. 14. NuGram Server JSP-like API Instantiation + Generation at once Java code creates the instantiation context Can access databases, webservices Can access application data Can access parameters passed on the request URL Build the URL, let the ASR fetch the generated grammar http://localhost:8800/nugram-servlet/grammars/address.grxml?code=h3b1a7 Output Format HTTP Parameters Copyright © 2010 Nu Echo Inc. 15. NuGram Server Java Context Initializers for full control publicclassCanadianAddressContextInitializerimplementsContextInitializer{public Map getContext(Map httpParameters,GrammarFragmentFactory factory,CacheControl control) {Map context = new HashMap();// 1. Extract the HTTP parameterString[] postalCode = httpParameters.get(“code”); // 2. Look in the postal code databasePostalCodeRecord[] records = findRecords(postalCode);// 3. Populate the instantiation contextcontext.add(“records”, records);context.add(“helper”, new AddressHelper(factory));return context; } Copyright © 2010 Nu Echo Inc. 16. NuGram Server JSP-like API – Tight integration with Java #ABNF 1.0 UTF-8;languagefr-CA;mode voice;root$address;public$address = @alt@for (record : records)@fragmenthelper.civicNumber(record)@wordrecord.streetName [@wordrecord.streetType]@end@end; Methods can be called on Java objects and produce grammar fragments (using a provided API) Supports bean properties - the real method is “getStreetName()” Copyright © 2010 Nu Echo Inc. 17. NuGram Server REST API HTTP-based Contexts sent to server as JSON objects Instantiation decoupled from generation for more effective use of resources Application POSTs request to instantiate the grammar NuGram Server replies with an URL Application passes the URL to the ASR ASR fetches grammar using the given URL Copyright © 2010 Nu Echo Inc. 18. Benefits No distinction between dynamic grammars and static grammars Supported by a complete development environment – NuGram IDE Editor, debugging tools, coverage tool, sentence generation tool, etc. – they all work with dynamic grammars Easy to use, easy to deploy Pure Java servlet technology A proven technology Deployed in many large IVR applications Copyright © 2010 Nu Echo Inc. 19. Try it, it’s free! NuGram Hosted Server (REST API only): http://www.grammarserver.com Ideal for cloud-based telephony applications(Tropo, Voxeo Evolution, Teleku, etc.) A bunch of client APIs: http://github.com/nuecho/nugramserver-clients And of course the IDE: http://nugram.nuecho.com/