|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.linguist.language.grammar.Grammar
Classes that implement this interface create grammars. A grammar
is represented internally as a graph of GrammarNodes
linked together by GrammarArcs
. Calling
getInitialNode
will return the first node
of the grammar graph. To traverse the grammar graph, one should
call GrammarNode.getSuccessors, which will return an array of GrammarArcs,
from which you can reach the neighboring GrammarNodes.
Note that all grammar probabilities are maintained in LogMath log domain.
Field Summary | |
static java.lang.String |
PROP_ADD_FILLER_WORDS
Property to control whether filler words are inserted into the graph |
static boolean |
PROP_ADD_FILLER_WORDS_DEFAULT
The default value for PROP_ADD_FILLER_WORDS |
static java.lang.String |
PROP_ADD_SIL_WORDS
Property to control whether silence words are inserted into the graph |
static boolean |
PROP_ADD_SIL_WORDS_DEFAULT
The default value for PROP_ADD_SIL_WORDS |
static java.lang.String |
PROP_DICTIONARY
Property that defines the dictionary to use for this grammar |
static java.lang.String |
PROP_OPTIMIZE_GRAMMAR
Property to control whether grammars are optimized or not |
static boolean |
PROP_OPTIMIZE_GRAMMAR_DEFAULT
The default value for PROP_OPTIMIZE_GRAMMAR |
static java.lang.String |
PROP_SHOW_GRAMMAR
Property to control the the dumping of the grammar |
static boolean |
PROP_SHOW_GRAMMAR_DEFAULT
The default value for PROP_SHOW_GRAMMAR. |
Constructor Summary | |
Grammar()
|
Method Summary | |
void |
allocate()
Create the grammar |
void |
deallocate()
Deallocate resources allocated to this grammar |
void |
dumpGrammar(java.lang.String name)
Dumps the grammar |
void |
dumpRandomSentences(int count)
Dump a set of random sentences that fit this grammar |
void |
dumpRandomSentences(java.lang.String path,
int count)
Dump a set of random sentences that fit this grammar |
void |
dumpStatistics()
Dumps statistics for this grammar |
java.util.Set |
getGrammarNodes()
returns the set of of nodes in this grammar |
GrammarNode |
getInitialNode()
Returns the initial node for the grammar |
java.lang.String |
getName()
Retrieves the name for this configurable component |
int |
getNumNodes()
returns the number of nodes in this grammar |
java.lang.String |
getRandomSentence()
Returns a random sentence that fits this grammar |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component has new data. |
void |
register(java.lang.String name,
Registry registry)
Register my properties. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PROP_SHOW_GRAMMAR
public static final boolean PROP_SHOW_GRAMMAR_DEFAULT
public static final java.lang.String PROP_OPTIMIZE_GRAMMAR
public static final boolean PROP_OPTIMIZE_GRAMMAR_DEFAULT
public static final java.lang.String PROP_ADD_SIL_WORDS
public static final boolean PROP_ADD_SIL_WORDS_DEFAULT
public static final java.lang.String PROP_ADD_FILLER_WORDS
public static final boolean PROP_ADD_FILLER_WORDS_DEFAULT
public static final java.lang.String PROP_DICTIONARY
Constructor Detail |
public Grammar()
Method Detail |
public void register(java.lang.String name, Registry registry) throws PropertyException
Configurable
register
in interface Configurable
name
- the name of the componentregistry
- the registry for this component
PropertyException
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
ps
- a property sheet holding the new data
PropertyException
- if there is a problem with the properties.public java.lang.String getName()
Configurable
getName
in interface Configurable
public void allocate() throws java.io.IOException
java.io.IOException
public void deallocate()
public GrammarNode getInitialNode()
public void dumpStatistics()
public void dumpRandomSentences(java.lang.String path, int count)
path
- the name of the file to dump the sentences tocount
- dumps no more than this. May dump less than this
depending upon the number of uniqe sentences in the
grammar.public void dumpRandomSentences(int count)
count
- dumps no more than this. May dump less than this
depending upon the number of uniqe sentences in the
grammar.public java.lang.String getRandomSentence()
public void dumpGrammar(java.lang.String name)
public int getNumNodes()
public java.util.Set getGrammarNodes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |