|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.recognizer.Recognizer
The Sphinx-4 recognizer. This is the main entry point for Sphinx-4. Typical usage of a recognizer is like so:
public void recognizeDigits() {
URL digitsConfig = new URL("file:./digits.xml");
ConfigurationManager cm = new ConfigurationManager(digitsConfig);
Recognizer sphinxDigitsRecognizer
= (Recognizer) cm.lookup("digitsRecognizer"");
boolean done = false;
Result result;
sphinxDigitsRecognizer.allocate();
// echo spoken digits, quit when 'nine' is spoken
while (!done) {
result = sphinxDigitsRecognizer.recognize();
System.out.println("Result: " + result);
done = result.toString().equals("nine");
}
sphinxDigitsRecognizer.deallocate();
}
Note that some Recognizer methods may throw an IllegalStateException if the
recognizer is not in the proper state
Field Summary | |
static java.lang.String |
PROP_DECODER
Property name for the decoder to be used by this recognizer. |
static java.lang.String |
PROP_MONITORS
Property name for the set of monitors for this recognizer |
Constructor Summary | |
Recognizer()
|
Method Summary | |
void |
addResultListener(ResultListener resultListener)
Adds a result listener to this recognizer. |
void |
addStateListener(StateListener stateListener)
Adds a status listener to this recognizer. |
void |
allocate()
Allocate the resources needed for the recognizer. |
void |
deallocate()
Deallocates the recognizer. |
java.lang.String |
getName()
Retrieves the name for this configurable component |
RecognizerState |
getState()
Retrieves the recognizer state. |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component has new data. |
Result |
recognize()
Performs recognition for the given number of input frames, or until a 'final' result is generated. |
Result |
recognize(java.lang.String referenceText)
Performs recognition for the given number of input frames, or until a 'final' result is generated. |
void |
register(java.lang.String name,
Registry registry)
Register my properties. |
void |
removeResultListener(ResultListener resultListener)
Removes a previously added result listener. |
void |
removeStateListener(StateListener stateListener)
Removes a previously added state listener. |
void |
resetMonitors()
Resets the monitors monitoring this recognizer |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PROP_DECODER
public static final java.lang.String PROP_MONITORS
Constructor Detail |
public Recognizer()
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 Result recognize(java.lang.String referenceText) throws java.lang.IllegalStateException
allocated
state.
referenceText
- what was actually spoken
java.lang.IllegalStateException
- if the recognizer is not in the ALLOCATED
statepublic Result recognize() throws java.lang.IllegalStateException
allocated
state.
java.lang.IllegalStateException
- if the recognizer is not in the ALLOCATED
statepublic void allocate() throws java.lang.IllegalStateException, java.io.IOException
deallocated
state.
java.lang.IllegalStateException
- if the recognizer is not in the DEALLOCATED
state
java.io.IOException
public void deallocate() throws java.lang.IllegalStateException
allocated
state.
java.lang.IllegalStateException
- if the recognizer is not in the ALLOCATED
statepublic RecognizerState getState()
public void resetMonitors()
public void addResultListener(ResultListener resultListener)
resultListener
- the listener to addpublic void addStateListener(StateListener stateListener)
stateListener
- the listener to addpublic void removeResultListener(ResultListener resultListener)
resultListener
- the listener to removepublic void removeStateListener(StateListener stateListener)
stateListener
- the state listener to removepublic java.lang.String getName()
Configurable
getName
in interface Configurable
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |