...
- Hash functions:
newMap()
: this function creates a new hash table.clear(var)
: empties the hash table stored in the variablevar
.get(var1,var2)
: returns the value associated to the keyvar2
in the hash tablevar1
.set(var1,var2,var3)
: sets the valuevar3
to the keyvar2
in the hash tablevar1
.
- List functions:
get(var1,var2)
: returns the value associated to indexvar2
in listvar1
(index can also be the string"random"
in that case the function returns a random element of the list).exists(var1,var2,var3)
: returns true iff there exists an element ofvar2
for whichvar3
is true when substituted to the variable namedvar1
.intersect(var1,var2)
: computes the intersection between the two given collections.len(var1)
: returns the length of the given list.removeIf(var1,var2,var3)
,removeIfNot(var1,var2,var3)
: returns the list formed by the elements of the listvar2
for which the boolean expressionvar3
is false (,true).var1
is the loop variable.set(var1,var2,var3)
: sets the valuevar3
at positionvar2
in listvar1
.subtract(var1,var2)
: removes all the elements in the listvar2
from the listvar1
.union(var1,var2)
: computes the union of the two lists.
- String functions:
match(var1,var2)
: maps to the String.matches(regexp) Java method. var1 must be a string or evaluate to one. var2 must be a string or evaluate to one. The content of var2 must be a valid Java regular expression.concatenate(var1,...,varn)
: concatenates the provided strings.
- Time functions:
- currentTime(): returns the current time in milliseconds since 1/1/1970.
getLastTimeMark(var1)
: returns the last time (in milliseconds since 1/1/1970) the current operator was in statevar1
, wherevar1
can be either "DONE" or "ENTER".getLastTimeMark(var1,var2)
: returns the last time the current operator said the speech actvar2
.Var1
must be "SAY".
- Ordering:
follows(var1,var2)
: var1 is a string constant (or a variable with a string constant as value) and var2 is a boolean (or a variable with a boolean value). Var2 is optional, by default it's false. The function returns true if the operator named by var1 has already been executed. If var2 is true, then the function returns true only if the operator named by var1 has already been completed (that is, any final state in the operator has been executed (as opposed to being swapped out before completion)).
- Topic:
isCurrentTopic(var)
: returns true if the provided string or variable containing a string matches one of the topics of the sub-dialogue currently active.isLastNonNullTopic(var)
: similar toisCurrentTopic
but executes the match on the last non null topic. That is, if currently there are no active networks, this will match the value of var with the topic of the last active network.
- Numbers:
min
(var1,...,varn)
,max(var1,...,varn)
: returns the min/max of the given list of numbers.random(var)
: generates a random number from 0 to the value invar
-1.var
doesn't have to be a variable but can also be a numeric constant.round(var)
: returns the output of java.lang.Math.round applied to the input argument when converted to a float value.
random(var)
: generates a random - Debug:
- trace(var): prints a java stack trace when var is evaluated.
- print(var): prints the value of var when the expression is evaluated by the system.
- Other:
if(var1,var2,var3)
: return the evaluation ofvar2
ifvar1
evaluates to true, ifvar1
evaluates to false it returns the evaluation ofvar3
. null ifvar1
returns null.known(expr)
: this returns true of the provided expression evaluates to anything but the NULL value.numToString(var)
: returns the string representation of the given number. For example, it returns "twenty three" for 23.hasBeenInterrupted(var)
: returns true if the current operator has been swapped out by an interruption.isInterruptible()
: returns true if the current transition being executed is interruptible (by the user).isQuestion(var)
: returns true if the provided var evaluates to a string that contains the string "question". This maps to the methodedu.usc.ict.nl.io.NLU.isQuestion
overwrite with your own specific NLU class if you want to customize or write a new custom function.
...