.. _jsgf_parser:
JSGF Parser
===========
| This JavaSpeechGrammarFormat-parser can generate grammar-trees.
| It is used by the :ref:`speech_recognition_tool` and can also operate alone.
| It also contains an annotation library from the Stanford CoreNLP toolkit in development.
Related resources
-----------------
Related projects:
- `JSGF at w3.org `_
- :ref:`speech_recognition_tool`
- `Sphinx4 at sourceforge `_
- `Sphinx4 at github `_
- `Stanford CoreNLP `_
Component repository:
- Browse component repository: `jsgf-parser `_.
- ``git clone http://projects.cit-ec.uni-bielefeld.de/git/agaispeechprocessing.git.jsgf-parser.git``
System startup:
The start script jsgfparser.sh can be found at ``/vol/csra//releases/trusty/lsp-csra-nightly/opt/jsgfparser/bin/jsgfparser``.
The program can be invoked with the following parameters:
-i , --hypotheses Input-Hypotheses. Multiple hypotheses separated by semicolon. e.g.:'hypothesis;another hypothesis'.
-o , --output File for result-output.
-g , --grammar JSGF-grammar to build trees from.
-n , --incremental Boolean if the given input-hypotheses may contain incremental units.
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:
HELLO FLOBI
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``.