public class FSTGrammar extends Grammar
I 2 F 0 2.30259 T 0 1 <unknown> <unknown> 2.30259 T 0 4 wood wood 1.60951 T 0 5 cindy cindy 1.60951 T 0 6 pittsburgh pittsburgh 1.60951 T 0 7 jean jean 1.60951 F 1 2.89031 T 1 0 , , 0.587725 T 1 4 wood wood 0.58785 F 2 3.00808 T 2 0 , , 0.705491 T 2 1 <unknown> <unknown> 0.58785 F 3 2.30259 T 3 0 F 4 2.89031 T 4 0 , , 0.587725 T 4 6 pittsburgh pittsburgh 0.58785 F 5 2.89031 T 5 0 , , 0.587725 T 5 7 jean jean 0.58785 F 6 2.89031 T 6 0 , , 0.587725 T 6 5 cindy cindy 0.58785 F 7 1.28093 T 7 0 , , 0.454282 T 7 4 wood wood 1.28093Key:
I - initial node, so "I 2" means node 2 is the initial node F - final node, e.g., "F 0 2.30259" means that node 0 is a final node, and the probability of finishing at node 0 is 2.30259 (in -ln) T - transition, "T 0 4 wood wood 1.60951" means "transitioning from node 0 to node 4, the output is wood and the machine is now in the node wood, and the probability associated with the transition is 1.60951 (in -ln)". "T 6 0 , , 0.587725" is a backoff transition, and the output is null (epsilon in the picture), and the machine is now in the null node.Probabilities read in from the FST file are in negative natural log format and are converted to the internal logMath log base.
As the FST file is read in, a Grammar object that is structurally equivalent to the FST is created. The steps of converting the FST file to a Grammar object are:
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_PATH
The property for the location of the FST n-gram file.
|
dictionary, initialNode, logger, PROP_ADD_FILLER_WORDS, PROP_ADD_SIL_WORDS, PROP_DICTIONARY, PROP_OPTIMIZE_GRAMMAR, PROP_SHOW_GRAMMAR
Constructor and Description |
---|
FSTGrammar() |
FSTGrammar(java.lang.String path,
boolean showGrammar,
boolean optimizeGrammar,
boolean addSilenceWords,
boolean addFillerWords,
Dictionary dictionary) |
Modifier and Type | Method and Description |
---|---|
protected GrammarNode |
createGrammar()
Creates the grammar.
|
protected GrammarNode |
createGrammar(java.lang.String bogusText)
Create class from reference text (not implemented).
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
allocate, createGrammarNode, createGrammarNode, createGrammarNode, createGrammarNode, createGrammarNode, deallocate, dumpGrammar, dumpRandomSentences, dumpRandomSentences, dumpStatistics, getDictionary, getGrammarNodes, getInitialNode, getNumNodes, getRandomSentence, newGrammar, postProcessGrammar
@S4String(defaultValue="default.arpa_gram") public static final java.lang.String PROP_PATH
public FSTGrammar(java.lang.String path, boolean showGrammar, boolean optimizeGrammar, boolean addSilenceWords, boolean addFillerWords, Dictionary dictionary)
public FSTGrammar()
protected GrammarNode createGrammar(java.lang.String bogusText) throws java.lang.NoSuchMethodException
createGrammar
in class Grammar
bogusText
- dummy variablejava.lang.NoSuchMethodException
- if called with reference sentencepublic void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
newProperties
in class Grammar
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.protected GrammarNode createGrammar() throws java.io.IOException
createGrammar
in class Grammar
java.io.IOException
- if the grammar could not be loaded