Changes between Version 31 and Version 32 of dialogmanager
- Timestamp:
- 01/04/24 15:36:07 (10 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
dialogmanager
v31 v32 110 110 111 111 == UpdateFunction 112 An UpdateFunction is a function programmed in Java (extending UpdateFunction class) that can be called from the json dialog file to change parameter values. 112 An UpdateFunction is a "function call" that manipulates the parameters. 113 114 An UpdateFunction is can be called from the preparation or evaliation part of the DialogPhase. 113 115 114 116 Generally these functions look like this in json … … 117 119 118 120 NameOfFunction is the name of a java class that implements the UpdateFunction class. 119 The arguments provided here are the CONSTRUCTOR arguments for NameOfFunction.121 The arguments val1... provided here are the CONSTRUCTOR arguments for NameOfFunction. Typically these are names of parameters. 120 122 121 T o evaluate, the function {{{call(Parameters parameters) }}} is called, and that call returns an updated {{{Parameters}}} value. An update function has access to all parameters and can change any of them. But generally it is good practice to only use/change parameters provided in the constructor. In above case, it would use123 Technically, the function {{{call(Parameters parameters) }}} is called to evaluate the function, and that call updates the {{{Parameters}}}. An update function has access to all parameters and can change any of them. But generally it is good practice to only use/change parameters provided in the constructor. 122 124 123 125 124 125 The incoming Parameters will be set to the current parameter values in the dialogstate . 126 The Parameters returned by the function will be put back into the parameter values of the dialogstate. 127 128 This mechanism allows the function to be called with different parameters as needed in the dialog. And it allows functions of arbitrary input and output arity. 129 130 131 132 133 The following are available: 126 The following are available in the library: 134 127 ||UpdateFunction||description||Additional parameters|| 135 128 ||Set||Directly sets the parameter to a given value. ||value: ParameterValue|| … … 139 132 ||SetFirstMatch||set parameter to the first value for which the condition holds, or the "orelse" value if no condition holds|| 140 133 ||SetIfElse||Sets parameter to the vtrue value if the condition holds, else to vfalse value|| 134 ||ContainsWord||returns BooleanValue, true iff the parameter contains the value within given tolerance. ||parameter: the parameter name, value:the {@link ParameterValue} to compare with, tolerance: the tolerance to weigh with.|| 135 141 136 142 137 Custom functions can be programmed in Java and then used in your json code. Of course make sure that your custom functions are properly attached to the json parser.