edu.cmu.sphinx.util.props
Interface Configurable

All Known Subinterfaces:
AcousticScorer, ActiveListFactory, ActiveListManager, DataProcessor, Dictionary, LanguageModel, Linguist, Loader, Pruner, SearchManager
All Known Implementing Classes:
AccuracyTracker, BaseDataProcessor, BatchModeRecognizer, BeamFinder, ConfigMonitor, Decoder, DynamicFlatLinguist, FastDictionary, FeatureStream, FlatLinguist, FullDictionary, Grammar, LargeTrigramModel, LexTreeLinguist, LinguistProcessor, LiveModeRecognizer, LogMath, MAPConfidenceScorer, MemoryTracker, Model, Model, Model, ModelLoader, ModelLoader, ModelLoader, NullPruner, ParallelAcousticScorer, ParallelSearchManager, PartitionActiveListFactory, Recognizer, RecognizerMonitor, RejectionTracker, SausageMaker, SimpleAcousticScorer, SimpleActiveListFactory, SimpleActiveListManager, SimpleBreadthFirstSearchManager, SimpleNGramModel, SimplePruner, SimpleWordListGrammar, SortingActiveListFactory, SpeedTracker, Sphinx3Loader, ThreadedAcousticScorer, TiedStateAcousticModel, TokenScorePruner, UnitManager, WordActiveListFactory, WordPruningBreadthFirstSearchManager

public interface Configurable

Defines the interface that must be implemented by any configurable component in Sphinx-4. The life cycle of a component is as follows:

Connecting to other components

Components often need to interact with other components in the system. One of the design goals of Sphinx-4 is that it allows for very flexible hookup of components in the system. Therefore, it is *not* considered good S4 style to hardcode which subcomponents a particular subcomponent is interacting with. Instead, the component should use the configuration manager to provide the hookup to another component. For example, if a component needs to interact with a Linguist. Instead of explicitly setting which linguist is to be used via a constructor or via a setLinguist call, the component should instead define a configuration property for the linguist. This would be done like so:

     public static String PROP_LINGUIST = "linguist";
 

This is registered in the register method:

     public void register(String name, Registry register) {
        registry.register(PROP_LINGUIST, PropertyType.COMPONENT);
     }
 

The linguist is made available in the newProperties method, like so:

     public void newProperties(PropertySheet propertySheet) {
      linguist = (Linguist) 
            propertySheet.getComponent(PROP_LINGUIST, Linguist.class);
     }
 
This getComponent call will find the proper linguist based upon the configuration data. Thus, if the configuration for this component had the 'linguist' defined to be 'dynamicLexTreeLinguist', then the configuration manager will look up and return a linguist with that name, creating and configuring it as necessary. Of course, the dynamicLexTreeLinguist itself may have a number of sub-components that will be created and configured as a result. If the component doesn't exist and no configuration information is found in the config file for it, or if it is of the wrong type, a PropertyException will be thrown.


Method Summary
 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.
 

Method Detail

register

public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
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

Parameters:
name - the name of the component
registry - the registry for this component
Throws:
PropertyException

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
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.

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()
Retrieves the name for this configurable component

Returns:
the name