edu.cmu.sphinx.tools.batch
Class BatchModeRecognizer

java.lang.Object
  extended byedu.cmu.sphinx.tools.batch.BatchModeRecognizer
All Implemented Interfaces:
Configurable

public class BatchModeRecognizer
extends java.lang.Object
implements Configurable

Decodes a batch file containing a list of files to decode. The files can be either audio files or cepstral files, but defaults to audio files. The audio data should be 16-bit, 16kHz, PCM-linear data. Since this classes makes use of Java Sound, it supports all the audio file formats that are supported by Java Sound. If the audio file does not correspond to a format supported by Java Sound, it is treated as a raw audio file (i.e., one without a header). Audio file formats differ in the endian order of the audio data. Therefore, it is important to specify it correctly in the configuration of the StreamDataSource. Note that in the ideal situation, the audio format of the data should be passed into the StreamDataSource, so that no extra configuration is needed. This will be fixed in future releases.

To run this BatchModeRecognizer:

 java BatchModeRecognizer <xmlConfigFile> <batchFile>
 
where xmlConfigFile is an XML-based configuration file and batchFile is a file listing all the files to decode and transcript of those files. For information about the configuration file, refer to the document Sphinx-4 Configuration Management. For information about the batch file, refer to the batch file description. This class will send recognition results to the logger if the log level is set to INFO.


Field Summary
static java.lang.String PROP_COUNT
          The SphinxProperty name for how many utterances to process
static int PROP_COUNT_DEFAULT
          The default value for the property PROP_COUNT.
static java.lang.String PROP_INPUT_DATA_PROCESSORS
          The sphinx property that specifies the input source
static java.lang.String PROP_RECOGNIZER
          The Sphinx property that specifies the recognizer to use
static java.lang.String PROP_SKIP
          The SphinxProperty name for how many files to skip for every decode.
static int PROP_SKIP_DEFAULT
          The default value for the property PROP_SKIP.
static java.lang.String PROP_TOTAL_BATCHES
          The SphinxProperty for the total number of batch jobs the decoding run is being divided into.
static int PROP_TOTAL_BATCHES_DEFAULT
          The default value for the property PROP_TOTAL_BATCHES.
static java.lang.String PROP_USE_POOLED_BATCH_MANAGER
          The SphinxProperty that defines whether or not the decoder should use the pooled batch manager
static boolean PROP_USE_POOLED_BATCH_MANAGER_DEFAULT
          The default value for the property PROP_USE_POOLED_BATCH_MANAGER.
static java.lang.String PROP_WHICH_BATCH
          The SphinxProperty that specified which batch job is to be run.
static int PROP_WHICH_BATCH_DEFAULT
          The default value for the property PROP_WHICH_BATCH.
 
Constructor Summary
BatchModeRecognizer()
           
 
Method Summary
 void decode(java.lang.String batchFile)
          Decodes the batch of audio files
 java.lang.String getName()
          Retrieves the name for this configurable component
static void main(java.lang.String[] argv)
          Main method of this BatchDecoder.
 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 setBatchFile(java.lang.String batchFile)
          Sets the batch file to use for this recogition
 void shell(java.lang.String batchfile)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_SKIP

public static final java.lang.String PROP_SKIP
The SphinxProperty name for how many files to skip for every decode.

See Also:
Constant Field Values

PROP_SKIP_DEFAULT

public static final int PROP_SKIP_DEFAULT
The default value for the property PROP_SKIP.

See Also:
Constant Field Values

PROP_COUNT

public static final java.lang.String PROP_COUNT
The SphinxProperty name for how many utterances to process

See Also:
Constant Field Values

PROP_COUNT_DEFAULT

public static final int PROP_COUNT_DEFAULT
The default value for the property PROP_COUNT.

See Also:
Constant Field Values

PROP_WHICH_BATCH

public static final java.lang.String PROP_WHICH_BATCH
The SphinxProperty that specified which batch job is to be run.

See Also:
Constant Field Values

PROP_WHICH_BATCH_DEFAULT

public static final int PROP_WHICH_BATCH_DEFAULT
The default value for the property PROP_WHICH_BATCH.

See Also:
Constant Field Values

PROP_TOTAL_BATCHES

public static final java.lang.String PROP_TOTAL_BATCHES
The SphinxProperty for the total number of batch jobs the decoding run is being divided into. The BatchDecoder supports running a subset of a batch. This allows a test to be distributed among several machines.

See Also:
Constant Field Values

PROP_TOTAL_BATCHES_DEFAULT

public static final int PROP_TOTAL_BATCHES_DEFAULT
The default value for the property PROP_TOTAL_BATCHES.

See Also:
Constant Field Values

PROP_USE_POOLED_BATCH_MANAGER

public static final java.lang.String PROP_USE_POOLED_BATCH_MANAGER
The SphinxProperty that defines whether or not the decoder should use the pooled batch manager

See Also:
Constant Field Values

PROP_USE_POOLED_BATCH_MANAGER_DEFAULT

public static final boolean PROP_USE_POOLED_BATCH_MANAGER_DEFAULT
The default value for the property PROP_USE_POOLED_BATCH_MANAGER.

See Also:
Constant Field Values

PROP_RECOGNIZER

public static final java.lang.String PROP_RECOGNIZER
The Sphinx property that specifies the recognizer to use

See Also:
Constant Field Values

PROP_INPUT_DATA_PROCESSORS

public static final java.lang.String PROP_INPUT_DATA_PROCESSORS
The sphinx property that specifies the input source

See Also:
Constant Field Values
Constructor Detail

BatchModeRecognizer

public BatchModeRecognizer()
Method Detail

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

setBatchFile

public void setBatchFile(java.lang.String batchFile)
                  throws java.io.IOException
Sets the batch file to use for this recogition

Parameters:
batchFile - the name of the batch file
Throws:
java.io.IOException - if the file could not be opened or read.

decode

public void decode(java.lang.String batchFile)
Decodes the batch of audio files

Throws:
java.io.IOException - if there is an I/O error processing the batch file

shell

public void shell(java.lang.String batchfile)

main

public static void main(java.lang.String[] argv)
Main method of this BatchDecoder.

Parameters:
argv - argv[0] : config.xml argv[1] : a file listing all the audio files to decode