|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface GrammarProcessor
The GrammarProcessor is the main entry point for
grammar processing.
This class provides a lean method interface to process a grammar in a VoiceXML file.
Copyright © 2005-2007 JVoiceXML group - http://jvoicexml.sourceforge.net/
| Field Summary | |
|---|---|
static String |
CONFIG_KEY
Configuration key. |
| Method Summary | |
|---|---|
void |
process(VoiceXmlInterpreterContext context,
Grammar grammar,
GrammarRegistry grammars)
Give in grammar into this processor and let it do it's job. |
| Field Detail |
|---|
static final String CONFIG_KEY
| Method Detail |
|---|
void process(VoiceXmlInterpreterContext context,
Grammar grammar,
GrammarRegistry grammars)
throws NoresourceError,
BadFetchError,
UnsupportedFormatError
Ok, to be a more specific, here is a short briefing, what is done to the grammar:
First of all, the grammar node is going to be walked along to check it's attributes and children. If it has a "src" attribut as well as an inline grammar an "error.badfetch" is thrown.
External grammars referenced by the src attribute as well as
external rule expansions are going to be fetched. This is done
in a loop until all external grammars are loaded.
While fetching all grammars one by one, the type and language
is going to be checked.
If a unsupported grammar type is referenced an
"UnsupportedFormatError" is thrown.
If a grammar for an unsupported language is fetched
"UnsupportedLanguageError" is thrown.
When there are no more external rule expansions, it is time to convert the grammar into a form, which can be passed to a JSAPI compliant ASR Engine. JSAPI 1.0 specifies that any compliant ASR engine must be able to process grammars in the JSGF Form.
To provide support for a wide range of grammars, it is possible
to create your own grammar transformer. The appropriate
transformer for the actual grammar is selected from a list of
registered GrammarTransformer. The resulting
RuleGrammar object is wrapped in a
Scopable object. The object is passed into a
container to make sure, the grammar can be activated at the
right time.
After this, the method returns.
context - The current context.grammar - The grammar to processgrammars - The used grammar registry.
NoresourceError - Error accessing the input device.
UnsupportedFormatError - If an unsupported grammar has to be processed.
BadFetchError - If the document could not be fetched successfully.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||