public abstract class AbstractDecoder extends java.lang.Object implements ResultProducer, Configurable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_ALLOCATE
If set to true the used search-manager will be automatically allocated
in
newProperties() . |
static java.lang.String |
FIRE_NON_FINAL_RESULTS
If set to
false the used search-manager all registered
result listeners will be notified only for final results. |
protected java.util.logging.Logger |
logger |
static java.lang.String |
PROP_RESULT_LISTENERS |
static java.lang.String |
PROP_SEARCH_MANAGER
The property that defines the name of the search manager to use
|
protected java.util.List<ResultListener> |
resultListeners |
protected SearchManager |
searchManager |
Constructor and Description |
---|
AbstractDecoder() |
AbstractDecoder(SearchManager searchManager,
boolean fireNonFinalResults,
boolean autoAllocate,
java.util.List<ResultListener> resultListeners)
Abstract decoder to implement live and batch recognizers
|
Modifier and Type | Method and Description |
---|---|
void |
addResultListener(ResultListener resultListener)
Adds a result listener to this recognizer.
|
void |
allocate()
Allocate resources necessary for decoding
|
void |
deallocate()
Deallocate resources
|
abstract Result |
decode(java.lang.String referenceText)
Decode frames until recognition is complete
|
protected void |
fireResultListeners(Result result)
Fires new results as soon as they become available.
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
void |
removeResultListener(ResultListener resultListener)
Removes a previously added result listener.
|
java.lang.String |
toString() |
@S4Component(type=SearchManager.class) public static final java.lang.String PROP_SEARCH_MANAGER
protected SearchManager searchManager
@S4ComponentList(type=ResultListener.class) public static final java.lang.String PROP_RESULT_LISTENERS
protected final java.util.List<ResultListener> resultListeners
@S4Boolean(defaultValue=false) public static final java.lang.String AUTO_ALLOCATE
newProperties()
.@S4Boolean(defaultValue=false) public static final java.lang.String FIRE_NON_FINAL_RESULTS
false
the used search-manager all registered
result listeners will be notified only for final results. Per default
non-final results don't trigger notification, because in most
application the utterance final result will be sufficient.protected java.util.logging.Logger logger
public AbstractDecoder()
public AbstractDecoder(SearchManager searchManager, boolean fireNonFinalResults, boolean autoAllocate, java.util.List<ResultListener> resultListeners)
searchManager
- search manager to usefireNonFinalResults
- to fire result during decodingautoAllocate
- automatic allocate all componentsresultListeners
- listeners to get noificationpublic abstract Result decode(java.lang.String referenceText)
referenceText
- the reference text (or null)public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.public void allocate()
public void deallocate()
public void addResultListener(ResultListener resultListener)
addResultListener
in interface ResultProducer
resultListener
- the listener to addpublic void removeResultListener(ResultListener resultListener)
removeResultListener
in interface ResultProducer
resultListener
- the listener to removeprotected void fireResultListeners(Result result)
result
- the new resultpublic java.lang.String toString()
toString
in class java.lang.Object