1.6.4. JSGF Parser¶
1.6.4.2. Interfaces¶
Input/Output:
It can parse a result generated from a grammar against this grammar to show its tree. For incremental units all possible trees are generated. The Parser is case-sensitive! Output format is xml.
Example:
<GREETING> HELLO <ROBOT> FLOBI </ROBOT> </GREETING>
1.6.4.3. Examples¶
Example 1:
You have a hypothesis that was generated from a jsgf-grammar and want to see its grammartree. For this task you can use the jsgf-parser quite simple. Start the script with the properties for the hypotheses and the used grammar-file.
So you have ./jsgfparser -g /somedirectory/jsgfgrammar.gram/ -i 'this is a hypothesis'
.
This will print the grammar tree to terminal.
Example 2:
If you want to store it in a file, just add it like following:
./jsgfparser -g /somedirectory/jsgfgrammar.gram/ -i 'this is a hypothesis' -o /whereYouWantYourOutputFile.txt
.
Example 3:
You may have incremental hypothesis you want to get a tree for. For this case, flag your input as incremental and the parser will produce trees that could fit the hypotheses.
./jsgfparser -g /somedirectory/jsgfgrammar.gram/ -i 'this is a' -n true
.