|
Copyright © 2009, 2010 Nu Echo Inc. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ContextInitializer
A ContextInitializer is an object used to programmatically create an instantiation context that will be merged with a dynamic grammar to produce a static grammar.
An instantiation context is a mapping between variable (strings) and
arbitrary values. The variables correspond to the top-level variables of a
dynamic grammar that are not defined in the grammar document (using
@for or @var directives, macro parameters, etc.).
Instantiation contexts are used by both NuGram Server and NuGram IDE.
Grammar fragments
In some situations, it is more practical to create some parts of the
generated grammar programmatically. In these cases, the supplied grammar
fragment factory object is used to create these grammar expansions. The
expansions are then put in the instantiation context and inserted in the
dynamic grammar using the @fragment directive).
Cache control
The context initializer is also responsible for providing fine-grained control of the grammar caching strategy. The CacheControl object provides several methods to give hints to the ASR engine on how to cache the generated grammar.
GrammarFragmentFactory,
CacheControl| Method Summary | |
|---|---|
java.util.Map |
getContext(java.util.Map parameters,
GrammarFragmentFactory factory,
CacheControl cacheControl)
Computes an instantiation context from a map of parameters. |
| Method Detail |
|---|
java.util.Map getContext(java.util.Map parameters,
GrammarFragmentFactory factory,
CacheControl cacheControl)
throws ContextInitializationException,
NotModifiedException
parameters - the input parametersfactory - a grammar fragment factory objectcacheControl - a cache control object
ContextInitializationException - when an error occurs during the
building of the instantiation context
NotModifiedException - if the generated grammar need not be
recomputed because it is already cached by the ASR engine
|
Copyright © 2009, 2010 Nu Echo Inc. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||