= Dialog Manager The dialog manager is a tool to create and execute dialogs with a human user. == Terminology * Dialog state. The current state of the dialog, comprising the situation and the user's answers so far. Stored as a set of Parameters. * Parameters. A set of key-value pairs where the keys are unique string labels and the values are a ParameterValue (a String, Double, or boolean). * Distance between parameters: 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 hoth parameters have the key are compared. * Dialog specification. A kind of finite state machine. The nodes are "dialog phases" and each have a unique label. The START and END phase indicate the usual start and end of the dialog. * Dialog phase. Each dialog phase represents a situation where we want the user to answer some question. This question can be formulated in different ways depending on the situation and user's previous answers. The dialog manager contains a number of key mechanisms * 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 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 options * The sentences can contain HTML code. ++picks one at raodom from the list of nearest