done.inpro.system.completion
Class TurnCompleter

java.lang.Object
  extended by inpro.incremental.PushBuffer
      extended by inpro.incremental.IUModule
          extended by done.inpro.system.completion.TurnCompleter
All Implemented Interfaces:
edu.cmu.sphinx.instrumentation.Resetable, edu.cmu.sphinx.util.props.Configurable, FrameAware

public class TurnCompleter
extends IUModule
implements FrameAware


Nested Class Summary
static interface TurnCompleter.CompletionAdapter
           
private  class TurnCompleter.CompletionEvalAdapter
           
private  class TurnCompleter.CompletionPlayer
          completions will only be played if they don't start with a pause
 
Nested classes/interfaces inherited from class inpro.incremental.IUModule
IUModule.RightBuffer
 
Field Summary
private  IUList<WordIU> committedWords
          history of words that have previously been recognized
private  java.util.List<TurnCompleter.CompletionAdapter> compAdapters
           
(package private)  int currentFrame
           
(package private)  CompletionInstallmentIU.FuzzyMatchResult fmatch
          fuzzy match of the full input against the expected full installment
(package private)  java.util.List<WordIU> fullInput
          full user input at one point in time: words that have been committed + currently hypothesized words
private  CompletionInstallmentIU fullInstallment
           
private static double OUTPUT_BUFFER_DELAY
          in seconds, very rough estimate
static java.lang.String PROP_DISPATCHER
           
static java.lang.String PROP_EVALUATOR
           
static java.lang.String PROP_FULL_UTTERANCE
           
private  java.util.HashSet<WordIU> wordsTriggered
          words from fullInstallment that have been output are stored here
 
Fields inherited from class inpro.incremental.IUModule
iulisteners, logger, PROP_HYP_CHANGE_LISTENERS, PROP_LOG_TO_TEDVIEW, PROP_TEDVIEW_LOG_ADDRESS, PROP_TEDVIEW_LOG_PORT, rightBuffer, tedLogAdapter
 
Constructor Summary
TurnCompleter()
           
 
Method Summary
private  void doComplete()
           
private  double estimateSpeechRate()
          estimate the correction factor relative to the TTS's speech rate
private  double extrapolateStart(double estimatedSpeechRate)
          extrapolate the start time of the next word from a list of previously spoken words
private static double getDurationWithoutPauses(java.util.List<WordIU> words)
          time spanned by all non-silent words
private  boolean hasFiredForTrigger()
          find out whether we have already fired for a word, to avoid stuttering; initial experiments shows that the first prediction for a word is as good as any later prediction so there's no value in trying repeatedly
private static
<T> T
lastElement(java.util.List<T> list)
          utility which unfortunately is not part of java.util.
protected  void leftBufferUpdate(java.util.Collection<? extends IU> ius, java.util.List<? extends EditMessage<? extends IU>> edits)
          the method that IU modules must implement
 void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
           
 void setCurrentFrame(int frame)
           
private  boolean shouldFire()
          determine whether we should complete the utterance based on the words heard so far
 
Methods inherited from class inpro.incremental.IUModule
getTime, hypChange, logToTedView
 
Methods inherited from class inpro.incremental.PushBuffer
reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_DISPATCHER

@S4Component(type=DispatchStream.class,
             mandatory=false)
public static final java.lang.String PROP_DISPATCHER
See Also:
Constant Field Values

PROP_EVALUATOR

@S4Component(type=CompletionEvaluator.class,
             mandatory=false)
public static final java.lang.String PROP_EVALUATOR
See Also:
Constant Field Values

compAdapters

private java.util.List<TurnCompleter.CompletionAdapter> compAdapters

PROP_FULL_UTTERANCE

@S4String(defaultValue="eins zwei drei vier f\u00fcnf sechs sieben")
public static final java.lang.String PROP_FULL_UTTERANCE
See Also:
Constant Field Values

OUTPUT_BUFFER_DELAY

private static double OUTPUT_BUFFER_DELAY
in seconds, very rough estimate


fullInstallment

private CompletionInstallmentIU fullInstallment

committedWords

private IUList<WordIU> committedWords
history of words that have previously been recognized


fullInput

java.util.List<WordIU> fullInput
full user input at one point in time: words that have been committed + currently hypothesized words


fmatch

CompletionInstallmentIU.FuzzyMatchResult fmatch
fuzzy match of the full input against the expected full installment


wordsTriggered

private java.util.HashSet<WordIU> wordsTriggered
words from fullInstallment that have been output are stored here


currentFrame

int currentFrame
Constructor Detail

TurnCompleter

public TurnCompleter()
Method Detail

newProperties

public void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
                   throws edu.cmu.sphinx.util.props.PropertyException
Specified by:
newProperties in interface edu.cmu.sphinx.util.props.Configurable
Overrides:
newProperties in class IUModule
Throws:
edu.cmu.sphinx.util.props.PropertyException

leftBufferUpdate

protected void leftBufferUpdate(java.util.Collection<? extends IU> ius,
                                java.util.List<? extends EditMessage<? extends IU>> edits)
Description copied from class: IUModule
the method that IU modules must implement

Specified by:
leftBufferUpdate in class IUModule
Parameters:
ius - list of IUs that make up the current hypothesis
edits - a list of edits since the last call

shouldFire

private boolean shouldFire()
determine whether we should complete the utterance based on the words heard so far


hasFiredForTrigger

private boolean hasFiredForTrigger()
find out whether we have already fired for a word, to avoid stuttering; initial experiments shows that the first prediction for a word is as good as any later prediction so there's no value in trying repeatedly


doComplete

private void doComplete()

extrapolateStart

private double extrapolateStart(double estimatedSpeechRate)
extrapolate the start time of the next word from a list of previously spoken words


estimateSpeechRate

private double estimateSpeechRate()
estimate the correction factor relative to the TTS's speech rate


getDurationWithoutPauses

private static double getDurationWithoutPauses(java.util.List<WordIU> words)
time spanned by all non-silent words


setCurrentFrame

public void setCurrentFrame(int frame)
Specified by:
setCurrentFrame in interface FrameAware

lastElement

private static <T> T lastElement(java.util.List<T> list)
utility which unfortunately is not part of java.util.