Modifier and Type | Class and Description |
---|---|
static class |
Model.Rule.Type
The types of rules that can be attached to nodes or features.
|
Constructor and Description |
---|
Rule()
No-arg rule constructor used by Gson deserialization.
|
Modifier and Type | Method and Description |
---|---|
String |
getId() |
String |
getKey() |
String[] |
getKeys() |
Prompt[] |
getPrompts() |
String |
getRedirectTo() |
SystemTurn |
getResponse(Model conversation)
Assuming the rule has been triggered, get the appropriate system
response.
|
Model.Rule.Type |
getType() |
String |
getValue() |
boolean |
shouldTrigger(io.spokestack.spokestack.dialogue.policy.UserTurn userTurn,
ConversationData conversationData,
boolean redirected)
Determine whether the rule should change the conversation flow based
on its criteria and the current state of the conversation.
|
public String getId()
public Model.Rule.Type getType()
public String getKey()
value
to determine whether the rule should trigger.public String[] getKeys()
Model.Rule.Type.SLOT_ONE_OF
rules, a list of slot names. One
must be present in the conversation data store to avoid triggering
the rule.public String getValue()
key
that should
match or not match in order to trigger a redirect.public String getRedirectTo()
public Prompt[] getPrompts()
public boolean shouldTrigger(io.spokestack.spokestack.dialogue.policy.UserTurn userTurn, ConversationData conversationData, boolean redirected)
userTurn
- The current user turn.conversationData
- The conversation data store.redirected
- Flag representing whether a redirect has
already been processed for the current turn.
Only one redirect per turn is honored in
order to avoid potential redirect cycles.true
if the rule should trigger, or cause a change in
conversation flow; false
if not.public SystemTurn getResponse(Model conversation)
null
.conversation
- The conversation policy used to retrieve nodes
and prompts referenced by the rule.Copyright © 2021. All rights reserved.