edu.cmu.sphinx.decoder.scorer
Class ThreadedAcousticScorer

java.lang.Object
  extended byedu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer
All Implemented Interfaces:
AcousticScorer, Configurable

public class ThreadedAcousticScorer
extends java.lang.Object
implements AcousticScorer

An acoustic scorer that breaks the scoring up into a configurable number of separate threads. All scores are maintained in LogMath log base


Field Summary
static java.lang.String PROP_ACOUSTIC_GAIN
          A sphinx property that controls the amount of acoustic gain.
static float PROP_ACOUSTIC_GAIN_DEFAULT
          The default value for the PROP_ACOUSTIC_LOOKAHEAD_FRAMES property.
static java.lang.String PROP_FRONTEND
          Property the defines the frontend to retrieve features from for scoring
static java.lang.String PROP_IS_CPU_RELATIVE
          A sphinx property name that controls whether the number of available CPUs on the system is used when determining the number of threads to use for scoring.
static boolean PROP_IS_CPU_RELATIVE_DEFAULT
          The default value for PROP_IS_CPU_RELATIVE.
static java.lang.String PROP_MIN_SCOREABLES_PER_THREAD
          A Sphinx Property name that controls the minimum number of scoreables sent to a thread.
static int PROP_MIN_SCOREABLES_PER_THREAD_DEFAULT
          The default value for PROP_MIN_SCOREABLES_PER_THREAD.
static java.lang.String PROP_NUM_THREADS
          A SphinxProperty name that controls the number of threads that are used to score hmm states.
static int PROP_NUM_THREADS_DEFAULT
          The default value for PROP_NUM_THREADS.
static java.lang.String PROP_SCOREABLES_KEEP_FEATURE
          A SphinxProperty specifying whether the scoreables should keep a reference to the scored features.
static boolean PROP_SCOREABLES_KEEP_FEATURE_DEFAULT
          The default value for PROP_SCOREABLES_KEEP_FEATURE.
 
Constructor Summary
ThreadedAcousticScorer()
           
 
Method Summary
 void allocate()
          Allocates resources for this scorer
 Scoreable calculateScores(java.util.List scoreableList)
          Scores the given set of states
 void deallocate()
          Deallocates resouces for this scorer
 java.lang.String getName()
          Retrieves the name for this configurable component
 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.
 void startRecognition()
          Initializes the scorer
 void stopRecognition()
          Performs post-recognition cleanup.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_FRONTEND

public static final java.lang.String PROP_FRONTEND
Property the defines the frontend to retrieve features from for scoring

See Also:
Constant Field Values

PROP_NUM_THREADS

public static final java.lang.String PROP_NUM_THREADS
A SphinxProperty name that controls the number of threads that are used to score hmm states. If the isCpuRelative property is false, then is is the exact number of threads that are used to score hmm states. if the isCpuRelative property is true, then this value is combined with the number of available proessors on the system. If you want to have one thread per CPU available to score states, set the NUM_THREADS property to 0 and the isCpuRelative to true. If you want exactly one thread to process scores set NUM_THREADS to 1 and isCpuRelative to false. The default value is 1

See Also:
Constant Field Values

PROP_NUM_THREADS_DEFAULT

public static final int PROP_NUM_THREADS_DEFAULT
The default value for PROP_NUM_THREADS.

See Also:
Constant Field Values

PROP_IS_CPU_RELATIVE

public static final java.lang.String PROP_IS_CPU_RELATIVE
A sphinx property name that controls whether the number of available CPUs on the system is used when determining the number of threads to use for scoring. If true, the NUM_THREADS property is combined with the available number of CPUS to deterimine the number of threads. Note that the number of threads is contrained to be never lower than zero. Also, if the number of threads is one, the states are scored on the calling thread, no separate threads are started. The default value is false.

See Also:
Constant Field Values

PROP_IS_CPU_RELATIVE_DEFAULT

public static final boolean PROP_IS_CPU_RELATIVE_DEFAULT
The default value for PROP_IS_CPU_RELATIVE.

See Also:
Constant Field Values

PROP_MIN_SCOREABLES_PER_THREAD

public static final java.lang.String PROP_MIN_SCOREABLES_PER_THREAD
A Sphinx Property name that controls the minimum number of scoreables sent to a thread. This is used to prevent over threading of the scoring that could happen if the number of threads is high compared to the size of the activelist. The default is 50

See Also:
Constant Field Values

PROP_MIN_SCOREABLES_PER_THREAD_DEFAULT

public static final int PROP_MIN_SCOREABLES_PER_THREAD_DEFAULT
The default value for PROP_MIN_SCOREABLES_PER_THREAD.

See Also:
Constant Field Values

PROP_SCOREABLES_KEEP_FEATURE

public static final java.lang.String PROP_SCOREABLES_KEEP_FEATURE
A SphinxProperty specifying whether the scoreables should keep a reference to the scored features.

See Also:
Constant Field Values

PROP_SCOREABLES_KEEP_FEATURE_DEFAULT

public static final boolean PROP_SCOREABLES_KEEP_FEATURE_DEFAULT
The default value for PROP_SCOREABLES_KEEP_FEATURE.

See Also:
Constant Field Values

PROP_ACOUSTIC_GAIN

public static final java.lang.String PROP_ACOUSTIC_GAIN
A sphinx property that controls the amount of acoustic gain.

See Also:
Constant Field Values

PROP_ACOUSTIC_GAIN_DEFAULT

public static final float PROP_ACOUSTIC_GAIN_DEFAULT
The default value for the PROP_ACOUSTIC_LOOKAHEAD_FRAMES property.

See Also:
Constant Field Values
Constructor Detail

ThreadedAcousticScorer

public ThreadedAcousticScorer()
Method Detail

allocate

public void allocate()
              throws java.io.IOException
Description copied from interface: AcousticScorer
Allocates resources for this scorer

Specified by:
allocate in interface AcousticScorer
Throws:
java.io.IOException

deallocate

public void deallocate()
Description copied from interface: AcousticScorer
Deallocates resouces for this scorer

Specified by:
deallocate in interface AcousticScorer

register

public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
Description copied from interface: Configurable
Register my properties. This method is called once early in the time of the component, shortly after the component is constructed. This component should register any configuration properties that it needs to register. If this configurable extends another configurable, super.register should also be called

Specified by:
register in interface Configurable
Parameters:
name - the name of the component
registry - the registry for this component
Throws:
PropertyException

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component has new data. The component should first validate the data. If it is bad the component should return false. If the data is good, the component should record the the data internally and return true.

Specified by:
newProperties in interface Configurable
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

getName

public java.lang.String getName()
Description copied from interface: Configurable
Retrieves the name for this configurable component

Specified by:
getName in interface Configurable
Returns:
the name

startRecognition

public void startRecognition()
Initializes the scorer

Specified by:
startRecognition in interface AcousticScorer

calculateScores

public Scoreable calculateScores(java.util.List scoreableList)
Scores the given set of states

Specified by:
calculateScores in interface AcousticScorer
Parameters:
scoreableList - a list containing scoreable objects to be scored
Returns:
the best scorign scoreable, or null if there are no more features to score

stopRecognition

public void stopRecognition()
Performs post-recognition cleanup.

Specified by:
stopRecognition in interface AcousticScorer