The NuGram approach to dynamic grammars
IntroductionWhat is a dynamic grammar?A grammar whose content is not known in advanceContent comes from an external sourceDatabaseExcel sheetWeb serviceData collected during the callEtc.Copyright © 2010 Nu Echo Inc.
IntroductionWhy dynamic grammars?Grammar content is only known at run-timeTo constrain grammars in order to improve recognition accuracyTo solve maintenance problemsMore 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.
Use CasesOn-the-fly generationContent comes from call-specific dataExamplesIdentity validationAddress captureVoice dialingPersonalized bill payee listPersonalized menu optionsOne-step correctionCopyright © 2010 Nu Echo Inc.
Use CasesOffline generation (triggered)‏Results from an external eventExamples:Auto-attendantMovie listingsCopyright © 2010 Nu Echo Inc.
Use CasesOffline generation (scheduled)‏Grammar generation is part of a scheduled maintenance processExamplesPhone numbers (area code may be added)‏Postal/Zip codesStock quotes, mutual fundsBill payee list managementCopyright © 2010 Nu Echo Inc.
Use CasesOffline generation (build time)‏For grammars based on company-specific dataUsually requires scheduled maintenance processExamplesBranch names and addressesStock quotes, mutual fundsBill payee list managementCopyright © 2010 Nu Echo Inc.
The NuGram ApproachSeamless evolutionCopyright © 2010 Nu Echo Inc.
The Generation ProcessABNFGrammarTemplateGrammarGSLInstantiationcontextGrXMLCopyright © 2010 Nu Echo Inc.
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.
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.
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.
NuGram ServerRuntime infrastructure to deploy dynamic grammarsJava ServlettechnologyCan run in parallel/be packaged with your applicationOutputs grammars in ABNF, GrXML, GSLFine-grained control of caching strategyUsing configuration or Java APITwo sets of APIsJSP-like API REST APICopyright © 2010 Nu Echo Inc.
NuGram ServerJSP-like APIInstantiation + Generation at onceJava code creates the instantiation contextCan access databases, webservicesCan access application dataCan access parameters passed on the request URLBuild the URL, let the ASR fetch the generated grammarhttp://localhost:8800/nugram-servlet/grammars/address.grxml?code=h3b1a7Output FormatHTTP ParametersCopyright © 2010 Nu Echo Inc.
NuGram ServerJava Context Initializers for full controlpublicclassCanadianAddressContextInitializerimplementsContextInitializer{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.
NuGram ServerJSP-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.
NuGram ServerREST APIHTTP-basedContexts sent to server as JSON objectsInstantiation decoupled from generation for more effective use of resources Application POSTs request to instantiate the grammarNuGram Server replies with an URL Application passes the URL to the ASR ASR fetches grammar using the given URLCopyright © 2010 Nu Echo Inc.
BenefitsNo distinction between dynamic grammars and static grammarsSupported by a complete development environment – NuGram IDEEditor, debugging tools, coverage tool, sentence generation tool, etc. – they all work with dynamic grammarsEasy to use, easy to deployPure Java servlet technologyA proven technologyDeployed in many large IVR applicationsCopyright © 2010 Nu Echo Inc.
Try it, it’s free!NuGram Hosted Server (REST API only): http://www.grammarserver.comIdeal for cloud-based telephony applications(Tropo, Voxeo Evolution, Teleku, etc.)A bunch of client APIs: http://github.com/nuecho/nugramserver-clientsAnd of course the IDE: http://nugram.nuecho.com/

The NuGram approach to dynamic grammars

  • 1.
    The NuGram approachto dynamic grammars
  • 2.
    IntroductionWhat is adynamic grammar?A grammar whose content is not known in advanceContent comes from an external sourceDatabaseExcel sheetWeb serviceData collected during the callEtc.Copyright © 2010 Nu Echo Inc.
  • 3.
    IntroductionWhy dynamic grammars?Grammarcontent is only known at run-timeTo constrain grammars in order to improve recognition accuracyTo solve maintenance problemsMore 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 CasesOn-the-fly generationContentcomes from call-specific dataExamplesIdentity validationAddress captureVoice dialingPersonalized bill payee listPersonalized menu optionsOne-step correctionCopyright © 2010 Nu Echo Inc.
  • 5.
    Use CasesOffline generation(triggered)‏Results from an external eventExamples:Auto-attendantMovie listingsCopyright © 2010 Nu Echo Inc.
  • 6.
    Use CasesOffline generation(scheduled)‏Grammar generation is part of a scheduled maintenance processExamplesPhone numbers (area code may be added)‏Postal/Zip codesStock quotes, mutual fundsBill payee list managementCopyright © 2010 Nu Echo Inc.
  • 7.
    Use CasesOffline generation(build time)‏For grammars based on company-specific dataUsually requires scheduled maintenance processExamplesBranch names and addressesStock quotes, mutual fundsBill payee list managementCopyright © 2010 Nu Echo Inc.
  • 8.
    The NuGram ApproachSeamlessevolutionCopyright © 2010 Nu Echo Inc.
  • 9.
  • 10.
    Start with anABNF 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#ABNF1.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 andcontrol-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 ServerRuntime infrastructureto deploy dynamic grammarsJava ServlettechnologyCan run in parallel/be packaged with your applicationOutputs grammars in ABNF, GrXML, GSLFine-grained control of caching strategyUsing configuration or Java APITwo sets of APIsJSP-like API REST APICopyright © 2010 Nu Echo Inc.
  • 14.
    NuGram ServerJSP-like APIInstantiation+ Generation at onceJava code creates the instantiation contextCan access databases, webservicesCan access application dataCan access parameters passed on the request URLBuild the URL, let the ASR fetch the generated grammarhttp://localhost:8800/nugram-servlet/grammars/address.grxml?code=h3b1a7Output FormatHTTP ParametersCopyright © 2010 Nu Echo Inc.
  • 15.
    NuGram ServerJava ContextInitializers for full controlpublicclassCanadianAddressContextInitializerimplementsContextInitializer{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 ServerJSP-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 ServerREST APIHTTP-basedContextssent to server as JSON objectsInstantiation decoupled from generation for more effective use of resources Application POSTs request to instantiate the grammarNuGram Server replies with an URL Application passes the URL to the ASR ASR fetches grammar using the given URLCopyright © 2010 Nu Echo Inc.
  • 18.
    BenefitsNo distinction betweendynamic grammars and static grammarsSupported by a complete development environment – NuGram IDEEditor, debugging tools, coverage tool, sentence generation tool, etc. – they all work with dynamic grammarsEasy to use, easy to deployPure Java servlet technologyA proven technologyDeployed in many large IVR applicationsCopyright © 2010 Nu Echo Inc.
  • 19.
    Try it, it’sfree!NuGram Hosted Server (REST API only): http://www.grammarserver.comIdeal for cloud-based telephony applications(Tropo, Voxeo Evolution, Teleku, etc.)A bunch of client APIs: http://github.com/nuecho/nugramserver-clientsAnd of course the IDE: http://nugram.nuecho.com/