This Python module takes one or more JSGF grammars and converts them to finite state transducers using OpenFST.
Optionally, ARPA language models can be created using Opengrm.
Requires OpenFST and the sphinx_jsgf2fsg
command. These are usually found in the libfst-dev
and sphinxbase-utils
Debian packages. Opengrm must be installed from source.
The typical usage for jsgf2fst
is:
- Create some JSGF grammars, one per intent
- Tag critical pieces of each sentence with a JSGF tag (e.g.,
(red | green){color}
) - Parse the JSGF grammar(s) using
pyjsgf
- Convert to FSTS with
jsgf2fst.jsgf2fst(...)
- Merge into a single acceptor FST with
jsgf2fst.make_intent_fst(...)
- Recognize intents from text with
jsgf2fst.fstaccept(...)
This library depends on a modified version of pyjsgf.