Changes between Version 31 and Version 32 of dialogmanager


Ignore:
Timestamp:
01/04/24 15:36:07 (11 months ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • dialogmanager

    v31 v32  
    110110
    111111== 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.
     112An UpdateFunction is a "function call" that manipulates the parameters.
     113
     114An UpdateFunction is can be called from the preparation or evaliation part of the DialogPhase.
    113115
    114116Generally these functions look like this in json
     
    117119
    118120NameOfFunction is the name of a java class that implements the UpdateFunction class.
    119 The arguments provided here are the CONSTRUCTOR arguments for NameOfFunction.
     121The arguments val1... provided here are the CONSTRUCTOR arguments for NameOfFunction. Typically these are names of parameters.
    120122
    121 To 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 use
     123Technically, 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.
    122124
    123125
    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:
     126The following are available in the library:
    134127||UpdateFunction||description||Additional parameters||
    135128||Set||Directly sets the parameter to a given value. ||value: ParameterValue||
     
    139132||SetFirstMatch||set parameter to the first value for which the condition holds, or the "orelse" value if no condition holds||
    140133||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
    141136
    142137Custom 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.