public class ThreadedAcousticScorer extends SimpleAcousticScorer
All scores are maintained in LogMath log base
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_IS_CPU_RELATIVE
The property that controls whether the number of available CPUs on the system is used when determining
the number of threads to use for scoring.
|
static java.lang.String |
PROP_MIN_SCOREABLES_PER_THREAD
The property that controls the minimum number of scoreables sent to a thread.
|
static java.lang.String |
PROP_NUM_THREADS
The property that controls the number of threads that are used to score HMM states.
|
static java.lang.String |
PROP_THREAD_PRIORITY
The property that controls the thread priority of scoring threads.
|
FEATURE_FRONTEND, frontEnd, SCORE_NORMALIZER, scoreNormalizer
logger
Constructor and Description |
---|
ThreadedAcousticScorer() |
ThreadedAcousticScorer(BaseDataProcessor frontEnd,
ScoreNormalizer scoreNormalizer,
int minScoreablesPerThread,
boolean cpuRelative,
int numThreads,
int threadPriority) |
Modifier and Type | Method and Description |
---|---|
void |
allocate()
Allocates resources for this scorer
|
void |
deallocate()
Deallocates resources for this scorer
|
protected <T extends Scoreable> |
doScoring(java.util.List<T> scoreableList,
Data data)
Scores a a list of
Scoreable s given a Data
-object. |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
calculateScores, calculateScoresAndStoreData, calculateScoresForData, getNextData, startRecognition, stopRecognition
getName, initLogger, toString
@S4Integer(defaultValue=5) public static final java.lang.String PROP_THREAD_PRIORITY
Thread.MIN_PRIORITY
and Thread.MAX_PRIORITY
, inclusive.
The default is Thread.NORM_PRIORITY
.@S4Integer(defaultValue=0) public static final java.lang.String PROP_NUM_THREADS
If the value is 1 isCpuRelative is false no additional thread will be instantiated, and all computation will be done in the calling thread itself. The default value is 0.
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_IS_CPU_RELATIVE
@S4Integer(defaultValue=10) public static final java.lang.String PROP_MIN_SCOREABLES_PER_THREAD
public ThreadedAcousticScorer(BaseDataProcessor frontEnd, ScoreNormalizer scoreNormalizer, int minScoreablesPerThread, boolean cpuRelative, int numThreads, int threadPriority)
frontEnd
- the frontend to retrieve features from for scoringscoreNormalizer
- optional post-processor for computed scores that will
normalize scores. If not set, no normalization will applied
and the token scores will be returned unchanged.minScoreablesPerThread
- 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 processors 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.
If the value is 1 isCpuRelative is false no additional thread will be instantiated, and all computation will be done in the calling thread itself. The default value is 0.
cpuRelative
- 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 determine the number of
threads. Note that the number of threads is constrained to be
never lower than zero. Also, if the number of threads is 0,
the states are scored on the calling thread, no separate
threads are started. The default value is false.numThreads
- 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 active list. The default is 50threadPriority
- the thread priority of scoring threads. Must be a value between
Thread.MIN_PRIORITY
and Thread.MAX_PRIORITY
, inclusive.
The default is Thread.NORM_PRIORITY
.public ThreadedAcousticScorer()
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
newProperties
in class SimpleAcousticScorer
ps
- a property sheet holding the new dataPropertyException
- if there is a problem with the properties.public void allocate()
AcousticScorer
allocate
in interface AcousticScorer
allocate
in class SimpleAcousticScorer
public void deallocate()
AcousticScorer
deallocate
in interface AcousticScorer
deallocate
in class SimpleAcousticScorer
protected <T extends Scoreable> T doScoring(java.util.List<T> scoreableList, Data data)
SimpleAcousticScorer
Scoreable
s given a Data
-object.doScoring
in class SimpleAcousticScorer
T
- type for scorablesscoreableList
- The list of Scoreables to be scoreddata
- The Data
-object to be used for scoring.Scoreable
or null
if
the list of scoreables was empty.