edu.cmu.sphinx.frontend.endpoint
Class NonSpeechDataFilter

java.lang.Object
  extended byedu.cmu.sphinx.frontend.BaseDataProcessor
      extended byedu.cmu.sphinx.frontend.endpoint.NonSpeechDataFilter
All Implemented Interfaces:
Configurable, DataProcessor

public class NonSpeechDataFilter
extends BaseDataProcessor

Given a sequence of Data, filters out the non-speech regions. The sequence of Data should have the speech and non-speech regions marked out by the SpeechStartSignal and SpeechEndSignal, using the SpeechMarker. Such a sequence of Data for an utterance should look like one of the following two:

Case 1: Only one speech region

In the first case, the data stream has only one speech region:


Figure 1: A data stream with only one speech region.

After filtering, the non-speech regions are removed, and becomes:


Figure 2: A data stream with only on speech region after filtering.


Case 2: Multiple speech regions

We will use the example of a data stream with two speech regions to illustrate the case of a data stream with multiple speech regions:


Figure 3: A data stream with two speech regions.

This case is more complicated than one speech region. The property mergeSpeechSegments is very important in controlling the behavior of this filter. This property determines whether individual speech regions (and the non-speech regions between them) in an utterance should be merged into one big region, or whether the individual speech regions should be converted into individual utterances. If mergeSpeechSegments is set to true, all the Data from the first SpeechStartSignal to the last SpeechEndSignal will be considered as one Utterance, and enclosed by a pair of DataStartSignal and DataEndSignal. All non-speech regions, as well as all SpeechStartSignals and SpeechEndSignals, are removed from the stream. This gives:


Figure 4: A data stream with two speech regions after filtering, when mergeSpeechSegments is set to true. Note that all SpeechStartSignals and SpeechEndSignals are removed.

On the other hand, if mergeSpeechSegments is set to false (the default), then each speech region will become its own data stream. Pictorially, our data stream with two speech regions becomes:


Figure 5: A data stream with two speech regions after filtering, when mergeSpeechSegments is set to false.

That is, the SpeechStartSignal replaced by DataStartSignal, the SpeechEndSignal replaced by DataEndSignal, and the non-speech regions are removed.


Field Summary
static java.lang.String PROP_MERGE_SPEECH_SEGMENTS
          The Sphinx Property that controls whether to merge discontiguous speech segments (and the non-speech segments between them) in an utterance into one big segment (true), or to treat the individual speech segments as individual utterances (false).
static boolean PROP_MERGE_SPEECH_SEGMENTS_DEFAULT
          The default value for PROP_MERGE_SPEECH_SEGMENTS.
 
Constructor Summary
NonSpeechDataFilter()
           
 
Method Summary
 Data getData()
          Returns the next Data or Signal.
 void initialize()
          Initializes this data processor
 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.
 
Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor
getName, getPredecessor, getTimer, setPredecessor, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_MERGE_SPEECH_SEGMENTS

public static final java.lang.String PROP_MERGE_SPEECH_SEGMENTS
The Sphinx Property that controls whether to merge discontiguous speech segments (and the non-speech segments between them) in an utterance into one big segment (true), or to treat the individual speech segments as individual utterances (false).

See Also:
Constant Field Values

PROP_MERGE_SPEECH_SEGMENTS_DEFAULT

public static final boolean PROP_MERGE_SPEECH_SEGMENTS_DEFAULT
The default value for PROP_MERGE_SPEECH_SEGMENTS.

See Also:
Constant Field Values
Constructor Detail

NonSpeechDataFilter

public NonSpeechDataFilter()
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
Overrides:
register in class BaseDataProcessor
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
Overrides:
newProperties in class BaseDataProcessor
Throws:
PropertyException

initialize

public void initialize()
Initializes this data processor

Specified by:
initialize in interface DataProcessor
Overrides:
initialize in class BaseDataProcessor

getData

public Data getData()
             throws DataProcessingException
Returns the next Data or Signal.

Specified by:
getData in interface DataProcessor
Specified by:
getData in class BaseDataProcessor
Returns:
the next Data, or null if no Data is available
Throws:
DataProcessingException - if a data processing error occurs