inpro.incremental.deltifier
Class SmoothingDeltifier

java.lang.Object
  extended by inpro.incremental.deltifier.ASRWordDeltifier
      extended by inpro.incremental.deltifier.SmoothingDeltifier
All Implemented Interfaces:
edu.cmu.sphinx.frontend.SignalListener, edu.cmu.sphinx.instrumentation.Resetable, edu.cmu.sphinx.util.props.Configurable, ASRResultKeeper
Direct Known Subclasses:
WordAdaptiveSmoothingDeltifier

public class SmoothingDeltifier
extends ASRWordDeltifier

only outputs IUs if a word is consecutively hypothesized for N frames. this is realized by overriding ASRWordDeltifier.deltify(Token).

for further reading, please see:

Timo Baumann, Michaela Atterer and David Schlangen (2009).
"Assessing and Improving the Performance of Speech Recognition for Incremental Systems".
in Proceedings of NAACL-HLT 2009, Boulder, USA.
Online: http://www.ling.uni-potsdam.de/~timo/pub/#naacl2009.

Author:
timo
See Also:
ASRWordDeltifier.deltify(Token)

Nested Class Summary
 class SmoothingDeltifier.SmoothingCounter
          stores the maturity for a given edit message
 
Field Summary
private  IUList<WordIU> prevWordIUs
           
static java.lang.String PROP_SMOOTHING
           
protected  int smoothing
           
protected  java.util.List<SmoothingDeltifier.SmoothingCounter> smoothingQueue
           
 
Fields inherited from class inpro.incremental.deltifier.ASRWordDeltifier
currentFrame, currentOffset, recoFinal, startTime, wordEdits, wordIUs
 
Constructor Summary
SmoothingDeltifier()
           
 
Method Summary
private  void addNewWordsToSmoothingQueue(EditMessage<WordIU> edit, java.util.Iterator<EditMessage<WordIU>> editsIter, java.util.List<SmoothingDeltifier.SmoothingCounter> smoothingQueue)
           
protected  void applySmoothingQueueToOutputWords()
          apply edits from smoothingQueue if their counters have run out, add them to edit list and update wordIUs NOTE: this implementation only handles smoothing factors that are constant for all words: how it works: going through the list of enqueued edits; while the word's counter has run out, add them to output, stop as soon as a counter is still counting
protected  void basicDeltify(edu.cmu.sphinx.decoder.search.Token token)
           
private  EditMessage<WordIU> compareToSmoothingQueueForMatchingWords(java.util.Iterator<EditMessage<WordIU>> editsIter, java.util.Iterator<SmoothingDeltifier.SmoothingCounter> smoothIter)
          compares incoming edits and smoothing list, decreases counters for matching smoothings and returns as soon as a non-matching word is found; this word is returned (as the underlying iterator can't go back :-(
protected  void deltify(edu.cmu.sphinx.decoder.search.Token token)
          deltifies using a smoothing algorithm.
protected  int getSmoothingFactor(EditMessage<WordIU> edit)
          return the smoothing factor that applies to this edit message
protected  void handleIncomingIUEdits()
          update smoothing counters for words of still-valid words in the smoothing queue, remove invalid ones, add new ones for new words
 void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
          this base implementation does not accept any parameters
private  void removeNonMatchingWordsFromSmoothingQueue(java.util.Iterator<SmoothingDeltifier.SmoothingCounter> smoothIter)
           
protected  void restoreOutputLists()
          initiate output lists
protected  void saveOutputLists()
           
 java.lang.String toString()
           
 
Methods inherited from class inpro.incremental.deltifier.ASRWordDeltifier
deltify, getCurrentFrame, getCurrentTime, getTokens, getWordEdits, getWordIUs, reset, setCollectTime, setOffset, signalOccurred
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_SMOOTHING

@S4Integer(defaultValue=0)
public static final java.lang.String PROP_SMOOTHING
See Also:
Constant Field Values

smoothing

protected int smoothing

smoothingQueue

protected java.util.List<SmoothingDeltifier.SmoothingCounter> smoothingQueue

prevWordIUs

private IUList<WordIU> prevWordIUs
Constructor Detail

SmoothingDeltifier

public SmoothingDeltifier()
Method Detail

newProperties

public void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
                   throws edu.cmu.sphinx.util.props.PropertyException
Description copied from class: ASRWordDeltifier
this base implementation does not accept any parameters

Specified by:
newProperties in interface edu.cmu.sphinx.util.props.Configurable
Overrides:
newProperties in class ASRWordDeltifier
Throws:
edu.cmu.sphinx.util.props.PropertyException

deltify

protected void deltify(edu.cmu.sphinx.decoder.search.Token token)
deltifies using a smoothing algorithm. words are only output when their IU has ``matured'', that is, has been proposed by the general deltification algorithm for a certain, consecutive number of frames (which is configurable)

Overrides:
deltify in class ASRWordDeltifier
Parameters:
token - the token from which the deltification starts

basicDeltify

protected void basicDeltify(edu.cmu.sphinx.decoder.search.Token token)

handleIncomingIUEdits

protected void handleIncomingIUEdits()
update smoothing counters for words of still-valid words in the smoothing queue, remove invalid ones, add new ones for new words


applySmoothingQueueToOutputWords

protected void applySmoothingQueueToOutputWords()
apply edits from smoothingQueue if their counters have run out, add them to edit list and update wordIUs NOTE: this implementation only handles smoothing factors that are constant for all words: how it works: going through the list of enqueued edits; while the word's counter has run out, add them to output, stop as soon as a counter is still counting


saveOutputLists

protected void saveOutputLists()

restoreOutputLists

protected void restoreOutputLists()
initiate output lists


compareToSmoothingQueueForMatchingWords

private EditMessage<WordIU> compareToSmoothingQueueForMatchingWords(java.util.Iterator<EditMessage<WordIU>> editsIter,
                                                                    java.util.Iterator<SmoothingDeltifier.SmoothingCounter> smoothIter)
compares incoming edits and smoothing list, decreases counters for matching smoothings and returns as soon as a non-matching word is found; this word is returned (as the underlying iterator can't go back :-(

Parameters:
editsIter -
smoothIter -
Returns:
the first non-matching word, or null if all words match

removeNonMatchingWordsFromSmoothingQueue

private void removeNonMatchingWordsFromSmoothingQueue(java.util.Iterator<SmoothingDeltifier.SmoothingCounter> smoothIter)

addNewWordsToSmoothingQueue

private void addNewWordsToSmoothingQueue(EditMessage<WordIU> edit,
                                         java.util.Iterator<EditMessage<WordIU>> editsIter,
                                         java.util.List<SmoothingDeltifier.SmoothingCounter> smoothingQueue)
Parameters:
edit - a (possibly null) edit to add first
editsIter - more edits to add
smoothingQueue - the queue to add to

getSmoothingFactor

protected int getSmoothingFactor(EditMessage<WordIU> edit)
return the smoothing factor that applies to this edit message

Parameters:
edit - ignored in this implementation
Returns:
smoothing factor for this edit; constant in this implementation

toString

public java.lang.String toString()
Overrides:
toString in class ASRWordDeltifier