devs.speechpackage
Class DialogManager

java.lang.Object
  extended by devs.speechpackage.DialogManager
All Implemented Interfaces:
edu.cmu.sphinx.util.props.Configurable

public class DialogManager
extends java.lang.Object
implements edu.cmu.sphinx.util.props.Configurable

The DialogManager is a component that is used to manage speech dialogs. A speech dialog is represented as a graph of dialog nodes. The dialog manager maintains an active node. When a node is active it is directing the recognition process. Typically a dialog node will define the current active grammar. The recognition result is typically used to direct the dialog manager to select the next active node. An application can easily customize the behavior at each active node.


Nested Class Summary
(package private)  class DialogManager.DialogNode
          Represents a node in the dialog
 
Field Summary
static java.lang.String PROP_JSGF_GRAMMAR
          Sphinx property that defines the name of the grammar component to be used by this dialog manager
static java.lang.String PROP_MICROPHONE
          Sphinx property that defines the name of the microphone to be used by this dialog manager
static java.lang.String PROP_RECOGNIZER
          Sphinx property that defines the name of the recognizer to be used by this dialog manager
 
Constructor Summary
DialogManager()
           
 
Method Summary
 void addNode(java.lang.String name, DialogNodeBehavior behavior)
          Adds a new node to the dialog manager.
 void allocate()
          Gets the recognizer and the dialog nodes ready to run
 void deallocate()
          Releases all resources allocated by the dialog manager
 java.lang.String getName()
          Returns the name of this component
 edu.cmu.sphinx.recognizer.Recognizer getRecognizer()
           
 void go()
          Invokes the dialog manager.
 void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
           
 void register(java.lang.String name, edu.cmu.sphinx.util.props.Registry registry)
           
 void setInitialNode(java.lang.String name)
          Sets the name of the initial node for the dialog manager
 void setRecognizer(edu.cmu.sphinx.recognizer.Recognizer recognizer)
          Sets the recognizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_JSGF_GRAMMAR

public static final java.lang.String PROP_JSGF_GRAMMAR
Sphinx property that defines the name of the grammar component to be used by this dialog manager

See Also:
Constant Field Values

PROP_MICROPHONE

public static final java.lang.String PROP_MICROPHONE
Sphinx property that defines the name of the microphone to be used by this dialog manager

See Also:
Constant Field Values

PROP_RECOGNIZER

public static final java.lang.String PROP_RECOGNIZER
Sphinx property that defines the name of the recognizer to be used by this dialog manager

See Also:
Constant Field Values
Constructor Detail

DialogManager

public DialogManager()
Method Detail

register

public void register(java.lang.String name,
                     edu.cmu.sphinx.util.props.Registry registry)
              throws edu.cmu.sphinx.util.props.PropertyException
Specified by:
register in interface edu.cmu.sphinx.util.props.Configurable
Throws:
edu.cmu.sphinx.util.props.PropertyException

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
Throws:
edu.cmu.sphinx.util.props.PropertyException

addNode

public void addNode(java.lang.String name,
                    DialogNodeBehavior behavior)
Adds a new node to the dialog manager. The dialog manager maintains a set of dialog nodes. When a new node is added the application specific beh

Parameters:
name - the name of the node
behavior - the application specified behavior for the node

setInitialNode

public void setInitialNode(java.lang.String name)
Sets the name of the initial node for the dialog manager

Parameters:
name - the name of the initial node. Must be the name of a previously added dialog node.

allocate

public void allocate()
              throws java.io.IOException
Gets the recognizer and the dialog nodes ready to run

Throws:
java.io.IOException - if an error occurs while allocating the recognizer.

deallocate

public void deallocate()
Releases all resources allocated by the dialog manager


go

public void go()
Invokes the dialog manager. The dialog manager begin to process the dialog states starting at the initial node. This method will not return until the dialog manager is finished processing states


getName

public java.lang.String getName()
Returns the name of this component

Specified by:
getName in interface edu.cmu.sphinx.util.props.Configurable
Returns:
the name of the component.

getRecognizer

public edu.cmu.sphinx.recognizer.Recognizer getRecognizer()

setRecognizer

public void setRecognizer(edu.cmu.sphinx.recognizer.Recognizer recognizer)
Sets the recognizer

Parameters:
recognizer - the recognizer