Version 9 (modified by 4 years ago) ( diff ) | ,
---|
Dialog Manager
The dialog manager is a tool to create and execute dialogs with a human user.
The basic dialog cycle as represented in DialogState and implemented in DemoApp is like this
while (!state.isFinal()) { state = state.withRandomOption(); Stimulus stimulus = state.getOption().getStimulation() .substitute(state.getParameters()); present stimulus String answer = get answer fitting state.getOption.getAnswerType(); state = state.with(answer);
Parameters
- The user's answers, current dialog state label, and other parameters relevant for the dialog are stored in a set of parameters. This is just a map with keys and values both strings. The keys are called the "variable name" and the values the "variable value".
- Distance between two parameters is the euclidean distance (sqrt of the sum of squares) of the difference between the two parameter values, on a per-key basis. Only values for which both parameters have the key are compared. For non-numeric values, the difference is usually 0 if the values are equal, or else 1. The exact definition differes per implementation.
- The parameter values are BoolValue ("bool"), DoubleValue ("num"), KeywordsValue ("keywords"), StringValue ("txt") and VectorValue ("vector"). Check the javadocs for more details.
- The Keywords parameters is useful if you want to do keyword matching. It contains a list of (case-insensitive) keywords. The distance to a list of words (eg another Keywords parameter or the words in a StringParameter) is the minimu distance of any of the words to any of the keywords. Here the Levenshtein distance is used to determine the distance between a word and a keyword.
Dialog specification
The dialog specification specifies the different states/phases of the dialog, and the set of questions (options) available at each phase. The following objects are used to represent this
- DialogSpecification. A kind of finite state machine. The nodes and edges are contained on a per-node basis in DialogPhases.
- DialogPhase. Each dialog phase represents a situation where we want the user to answer some question. Each has a unique label. The START and END label indicate the usual start and end of the dialog.
In each phase, a number of similar questions called DialogOption are available. Also the DialogPhase defines the NestPhase which can determine what is the next DialogPhase to go.
- A DialogOption is one of multiple ways to proceed in a given {@link DialogPhase}. It consists of a simulation (something presented to the user, eg a question) and the answer type expected from the user (eg, a number between 0 and 10).
- Dialog state. The current state of the dialogL the DialogSpecification, a set of Parameters comprising the culmination of the user's answers so far, and the (randomly) chosen DialogOption for the current Phase.
- All data structures can be (de)serialized to JSON.
- Various datastructures available to store key elements for dialog management
- a DialogState represent the entire dialog state plus the entire dialog specification in a single file. Useful to store/recover the entire user state in one single file
- A DialogSpecification represents all possible dialog phases. Useful to storethe entire dialog tree but without the user's answers so far
- Parameters that store the user's answers so far
- The NextPhase mechanism determines the next phase, based on the current parameter settings. The GoToIf selects the phase that has parameters that are smallest distance to the current state ++. The GoTo unconditionally jumps to the given state.
- A DialogPhase can have multiple options, from which the one with the smallest distance to the current state++ is chosen.
- Parameters can be manipulated programmatically, eg to update fields or incorporate data external to the dialog system such as system time, network state, database fields, etc.
- Parameters can be used directly in the sentences and the available answers
- The sentences can contain HTML code.
++picks one at raodom from the list of nearest
Note:
See TracWiki
for help on using the wiki.