org.finetracker
Class Configuration

java.lang.Object
  extended by org.finetracker.Configuration

public class Configuration
extends java.lang.Object

The Configuration class takes care of the configuration of the application. It initializes and keeps all the settings. It is implemented as a singleton. Initialization is done as follows:

 Configuration.init(args);
 Configuration.initSilenceVector();
 
One can then retrieve individual parameters from the object returned by getInstance(). For example, the maximum number of hypothesis can be retrieved as follows:
 Configuration.getInstance().getMaxHypothesis()
 
If the order of initialization or retrieval of parameters is mixed up, an IllegalStateException will be thrown. See the documentation of the specific methods for more information.

Author:
Frank Kusters

Method Summary
 boolean getApplyBigramPenalty()
           
 boolean getApplyUnigramPenalty()
           
 java.lang.String getDistanceCalculation()
           
 double getDistanceWeight()
          Retrieves the distance weight from the configuration.
static Configuration getInstance()
          Gets the singleton instance of the Configuration class.
 java.lang.String getLanguageModel()
           
 double getLanguageModelWeight()
           
 java.lang.String getLexicon()
           
 int getMaxHypothesis()
          Retrieves the maximum number of hypotheses from the configuration.
 boolean getMoveupBigramPenalty()
           
 boolean getOnlyUniqueHypotheses()
           
 int getOutputEachNIterations()
          Retrieves the number of iterations before showing output from the configuration.
 int getOutputNBest()
          Retrieves the number of best matches to output from the configuration.
 boolean getPushUnigramPenalty()
           
 boolean getShowFrameCounts()
          Retrieves whether frame counts must be shown from the configuration.
 boolean getShowIntermediateResults()
          Retrieves the whether intermediate results must be shown from the configuration.
 boolean getShowLMPenalties()
           
 int getShowMaxNDigitsPrecision()
          Retrieves the maximum number of digits precision that is shown from the configuration.
 double getSilencePenalty()
          This is a penalty that is applied when silence is matched against the input.
 FeatureVector getSilenceVector()
          Gets the silence vector from the configuration object.
 double getSimultaneousEnd()
           
 double getSimultaneousStart()
           
 double getStepInInputPenalty()
           
 double getStepInLexiconPenalty()
           
 java.lang.String getUtterance()
           
 int getVectorLength()
          Retrieves the vector length from the configuration.
 double getWordEntrancePenalty()
           
 double getWordNotFinishedPenalty()
           
static void init(java.lang.String[] args)
          This is a wrapper for the Configuration(String[]) constructor, storing a new singleton Configuration object in singleton.
static void initSilenceVector()
          Converts the silence vector for use in the rest of the application.
 boolean isSilenceEnabled()
          Retrieves the whether silence is enabled from the configuration.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static void init(java.lang.String[] args)
                 throws java.lang.IllegalStateException,
                        java.io.IOException
This is a wrapper for the Configuration(String[]) constructor, storing a new singleton Configuration object in singleton. If the object was already initialized, an IllegalStateException is thrown. This method has to finish successfully before any of the instance methods can be called. Settings can originate from: a file, the default settings or the command line, depending on the content of args.

Parameters:
args - an array of Strings containing the arguments as normally used in a main() method. If any of the elements is equal to "--exportconfig", the default settings will be exported to a file having the name of the String following that element. If the array is zero-length, usage of the application is displayed. Otherwise, the file specified by the argument which is not a command line option will be read to extract settings stored in it. The other arguments are parsed and override the options from the configuration file.
Throws:
java.lang.IllegalStateException - if the configuration object is initialized more than once.
java.io.IOException - when there is a problem with the command line or the configuration file. The details of the exception are stored in the message.

initSilenceVector

public static void initSilenceVector()
                              throws java.io.IOException
Converts the silence vector for use in the rest of the application. This is to prevent it from needing to be repeatedly converted from a String to an actual FeatureVector. This method cannot be called before init(String[]), because at that point it is not defined what the silence vector is (so it cannot be converted).

Throws:
java.io.IOException - if the conversion failed (because an invalid vector was entered)

getInstance

public static Configuration getInstance()
                                 throws java.lang.IllegalStateException
Gets the singleton instance of the Configuration class. If the singleton is not yet initialized, an exception is thrown.

Returns:
the singleton object representing the configuration
Throws:
java.lang.IllegalStateException - if the singleton is not initialized

getApplyUnigramPenalty

public boolean getApplyUnigramPenalty()

getApplyBigramPenalty

public boolean getApplyBigramPenalty()

getLanguageModelWeight

public double getLanguageModelWeight()

getPushUnigramPenalty

public boolean getPushUnigramPenalty()

getMoveupBigramPenalty

public boolean getMoveupBigramPenalty()

getShowLMPenalties

public boolean getShowLMPenalties()

getLanguageModel

public java.lang.String getLanguageModel()

getSimultaneousStart

public double getSimultaneousStart()

getSimultaneousEnd

public double getSimultaneousEnd()

getOnlyUniqueHypotheses

public boolean getOnlyUniqueHypotheses()

getLexicon

public java.lang.String getLexicon()

getSilencePenalty

public double getSilencePenalty()
This is a penalty that is applied when silence is matched against the input. This is additional to the distance between input and the silence vector.

Returns:
the silence penalty

getStepInInputPenalty

public double getStepInInputPenalty()

getStepInLexiconPenalty

public double getStepInLexiconPenalty()

getUtterance

public java.lang.String getUtterance()

getWordEntrancePenalty

public double getWordEntrancePenalty()

getWordNotFinishedPenalty

public double getWordNotFinishedPenalty()

getVectorLength

public int getVectorLength()
Retrieves the vector length from the configuration.

Returns:
the vector length

getMaxHypothesis

public int getMaxHypothesis()
Retrieves the maximum number of hypotheses from the configuration.

Returns:
the maximum number of hypotheses

getDistanceCalculation

public java.lang.String getDistanceCalculation()

getDistanceWeight

public double getDistanceWeight()
Retrieves the distance weight from the configuration.

Returns:
the distance weight

getShowIntermediateResults

public boolean getShowIntermediateResults()
Retrieves the whether intermediate results must be shown from the configuration.

Returns:
whether intermediate results must be shown

isSilenceEnabled

public boolean isSilenceEnabled()
Retrieves the whether silence is enabled from the configuration. If no silence vector was found in the configuration file, it is assumed that silence is not enabled.

Returns:
whether silence is enabled

getSilenceVector

public FeatureVector getSilenceVector()
Gets the silence vector from the configuration object. It was converted from the string that is stored in the configuration file to a FeatureVector by convertSilenceVector(). It can never be null, because the program should have already stopped.

Returns:
the silence vector

getOutputEachNIterations

public int getOutputEachNIterations()
Retrieves the number of iterations before showing output from the configuration.

Returns:
the number of iterations

getOutputNBest

public int getOutputNBest()
Retrieves the number of best matches to output from the configuration.

Returns:
the number of best matches to output

getShowFrameCounts

public boolean getShowFrameCounts()
Retrieves whether frame counts must be shown from the configuration.

Returns:
whether frame counts must be shown

getShowMaxNDigitsPrecision

public int getShowMaxNDigitsPrecision()
Retrieves the maximum number of digits precision that is shown from the configuration.

Returns:
the maximum number of digits precision