I’m trying to append values to list slot but failed. It seems no documentation is available for such behavior.
stories:
Rearrange words question with no option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“N”: “no”}
- slot{“N”: “no”}
- utter_rearrange_structure
- action_slot_reset
- action_restart
Rearrange words question with no option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“N”: “no”}
- slot{“N”: “no”}
- utter_rearrange_structure
- action_slot_reset
- action_restart
Rearrange words question with no option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“N”: “no”}
- slot{“N”: “no”}
- utter_rearrange_structure
- action_slot_reset
- action_restart
Rearrange words question with no option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“N”: “no”}
- slot{“N”: “no”}
- utter_rearrange_structure
- action_slot_reset
- action_restart
Rearrange words question with no option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“N”: “no”}
- slot{“N”: “no”}
- utter_rearrange_structure
- action_slot_reset
- action_restart
Rearrange words question with yes option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“Y”: “yes”}
- slot{“Y”: “yes”}
- utter_ask_rearrange_question_1
- rearrange.answer{“S”: “we”, “V”: “should eat”, “P”: “enough vegetables and cereals”}
- slot{“P”: [“enough vegetables and cereals”]}
- slot{“S”: [“we”]}
- slot{“V”: [“should eat”]}
- action_slot_set
- utter_ask_rearrange_question_2
- rearrange.answer{“S”: “he”, “V”: “has”, “P”: “plenty of time to sleep”, “C”: “because”, “S”:“he”, “V”:“likes”, “P”:“his job”}
- slot{“C”: [“because”]}
- slot{“P”: [“his job”, “plenty of time to sleep”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“likes”, “has”]}
- action_slot_set
- utter_ask_rearrange_question_3
- rearrange.answer{“S”: “he”, “V”: “works”, “P”: “on a plane”, “C”: “because”, “S”: “he”, “V”: “needs”, “P”: “to be very careful”}
- slot{“C”: [“because”]}
- slot{“P”: [“to be very careful”, “on a plane”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“needs”, “works”]}
- action_slot_set
- utter_ask_rearrange_question_4
- rearrange.answer{“S”: “it”, “V”: “give”, “C”: “and”, “P”: “you vitamins”, “V”: “is”, “S”:“vegetables and fruits”, “C”:“because”}
- slot{“C”: [“because”, “and”]}
- slot{“P”: [“you vitamins”]}
- slot{“S”: [“it”, “vegetables and fruits”]}
- slot{“V”: [“is”, “give”]}
- action_slot_set
- utter_ask_rearrange_question_5
- rearrange.answer{“S”: “she”, “V”: “take”, “P”: “photos of famous people”}
- slot{“P”: [“photos of famous people”]}
- slot{“S”: [“she”]}
- slot{“V”: [“takes”]}
- action_slot_set
- action_check_answer
- action_slot_reset
Rearrange words question with yes option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“Y”: “yes”}
- slot{“Y”: “yes”}
- utter_ask_rearrange_question_1
- rearrange.answer{“S”: “we”, “V”: “should eat”, “P”: “enough vegetables and cereals”}
- slot{“P”: [“enough vegetables and cereals”]}
- slot{“S”: [“we”]}
- slot{“V”: [“should eat”]}
- action_slot_set
- utter_ask_rearrange_question_2
- rearrange.answer{“S”: “he”, “V”: “has”, “P”: “plenty of time to sleep”, “C”: “because”, “S”:“he”, “V”:“likes”, “P”:“his job”}
- slot{“C”: [“because”]}
- slot{“P”: [“his job”, “plenty of time to sleep”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“likes”, “has”]}
- action_slot_set
- utter_ask_rearrange_question_3
- rearrange.answer{“S”: “he”, “V”: “works”, “P”: “on a plane”, “C”: “because”, “S”: “he”, “V”: “needs”, “P”: “to be very careful”}
- slot{“C”: [“because”]}
- slot{“P”: [“to be very careful”, “on a plane”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“needs”, “works”]}
- action_slot_set
- utter_ask_rearrange_question_4
- rearrange.answer{“S”: “it”, “V”: “give”, “C”: “and”, “P”: “you vitamins”, “V”: “is”, “S”:“vegetables and fruits”, “C”:“because”}
- slot{“C”: [“because”, “and”]}
- slot{“P”: [“you vitamins”]}
- slot{“S”: [“it”, “vegetables and fruits”]}
- slot{“V”: [“is”, “give”]}
- action_slot_set
- utter_ask_rearrange_question_5
- rearrange.answer{“S”: “she”, “V”: “take”, “P”: “photos of famous people”}
- slot{“P”: [“photos of famous people”]}
- slot{“S”: [“she”]}
- slot{“V”: [“takes”]}
- action_slot_set
- action_check_answer
- action_slot_reset
Rearrange words question with yes option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“Y”: “yes”}
- slot{“Y”: “yes”}
- utter_ask_rearrange_question_1
- rearrange.answer{“S”: “we”, “V”: “should eat”, “P”: “enough vegetables and cereals”}
- slot{“P”: [“enough vegetables and cereals”]}
- slot{“S”: [“we”]}
- slot{“V”: [“should eat”]}
- action_slot_set
- utter_ask_rearrange_question_2
- rearrange.answer{“S”: “he”, “V”: “has”, “P”: “plenty of time to sleep”, “C”: “because”, “S”:“he”, “V”:“likes”, “P”:“his job”}
- slot{“C”: [“because”]}
- slot{“P”: [“his job”, “plenty of time to sleep”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“likes”, “has”]}
- action_slot_set
- utter_ask_rearrange_question_3
- rearrange.answer{“S”: “he”, “V”: “works”, “P”: “on a plane”, “C”: “because”, “S”: “he”, “V”: “needs”, “P”: “to be very careful”}
- slot{“C”: [“because”]}
- slot{“P”: [“to be very careful”, “on a plane”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“needs”, “works”]}
- action_slot_set
- utter_ask_rearrange_question_4
- rearrange.answer{“S”: “it”, “V”: “give”, “C”: “and”, “P”: “you vitamins”, “V”: “is”, “S”:“vegetables and fruits”, “C”:“because”}
- slot{“C”: [“because”, “and”]}
- slot{“P”: [“you vitamins”]}
- slot{“S”: [“it”, “vegetables and fruits”]}
- slot{“V”: [“is”, “give”]}
- action_slot_set
- utter_ask_rearrange_question_5
- rearrange.answer{“S”: “she”, “V”: “take”, “P”: “photos of famous people”}
- slot{“P”: [“photos of famous people”]}
- slot{“S”: [“she”]}
- slot{“V”: [“takes”]}
- action_slot_set
- action_check_answer
- action_slot_reset
Rearrange words question with yes option
- greet
- utter_greet
- utter_rearrange_question_detail
- utter_rearrange_question
- rearrange.yes_no{“Y”: “yes”}
- slot{“Y”: “yes”}
- utter_ask_rearrange_question_1
- rearrange.answer{“S”: “we”, “V”: “should eat”, “P”: “enough vegetables and cereals”}
- slot{“P”: [“enough vegetables and cereals”]}
- slot{“S”: [“we”]}
- slot{“V”: [“should eat”]}
- action_slot_set
- utter_ask_rearrange_question_2
- rearrange.answer{“S”: “he”, “V”: “has”, “P”: “plenty of time to sleep”, “C”: “because”, “S”:“he”, “V”:“likes”, “P”:“his job”}
- slot{“C”: [“because”]}
- slot{“P”: [“his job”, “plenty of time to sleep”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“likes”, “has”]}
- action_slot_set
- utter_ask_rearrange_question_3
- rearrange.answer{“S”: “he”, “V”: “works”, “P”: “on a plane”, “C”: “because”, “S”: “he”, “V”: “needs”, “P”: “to be very careful”}
- slot{“C”: [“because”]}
- slot{“P”: [“to be very careful”, “on a plane”]}
- slot{“S”: [“he”, “he”]}
- slot{“V”: [“needs”, “works”]}
- action_slot_set
- utter_ask_rearrange_question_4
- rearrange.answer{“S”: “it”, “V”: “give”, “C”: “and”, “P”: “you vitamins”, “V”: “is”, “S”:“vegetables and fruits”, “C”:“because”}
- slot{“C”: [“because”, “and”]}
- slot{“P”: [“you vitamins”]}
- slot{“S”: [“it”, “vegetables and fruits”]}
- slot{“V”: [“is”, “give”]}
- action_slot_set
- utter_ask_rearrange_question_5
- rearrange.answer{“S”: “she”, “V”: “take”, “P”: “photos of famous people”}
- slot{“P”: [“photos of famous people”]}
- slot{“S”: [“she”]}
- slot{“V”: [“takes”]}
- action_slot_set
- action_check_answer
- action_slot_reset
domain.yml
slots:
Y:
type: text
N:
type: text
S:
type: list
V:
type: list
P:
type: list
C:
type: list
rearrange_answers:
type: list
entities:
- Y
- N
- S
- C
- P
- V
intents:
- rearrange.detail
- rearrange.question
- rearrange.answer
- rearrange.yes_no
- greet
templates: utter_greet:
- text: “I’m fine, thanks” utter_rearrange_question_detail:
- text: “Holly is playing a game. Read the words and rearrange the words in correct order.” utter_rearrange_question:
- text: “Do you know what a sentence structure is? (Yes / No)” utter_ask_rearrange_question_1:
- text: “Enough / , / vegetables / cereals / we / eat / should / and /” utter_ask_rearrange_question_2:
- text: “likes / his job / to sleep / , / he / because / plenty of time / has / he” utter_ask_rearrange_question_3:
- text: “works / he / very / needs / , / to be / careful / on a plane / because / he” utter_ask_rearrange_question_4:
- text: “give / , / is / fruit / because / you / vitamins / it / and / vegetables” utter_ask_rearrange_question_5:
- text: “famous / , / photos / she / beautiful / takes / of / people” utter_rearrange_structure:
- text: “A basic sentence structure is as follow” image: “Imgur: The magic of the Internet”
actions:
- utter_greet
- utter_rearrange_question
- utter_rearrange_question_detail
- utter_show_rearrange_detail
- utter_rearrange_structure
- utter_ask_rearrange_question_1
- utter_ask_rearrange_question_2
- utter_ask_rearrange_question_3
- utter_ask_rearrange_question_4
- utter_ask_rearrange_question_5
- action_check_answer
- action_slot_reset
- action_slot_set
- action_restart
policies:
- name: KerasPolicy epochs: 100 max_history: 15
- name: FallbackPolicy nlu_threshold: 0.4 core_threshold: 0.3 fallback_action_name: ‘action_default_fallback’
- name: MemoizationPolicy max_history: 15
- name: FormPolicy
slot rearrange_answers
only get the latest text from the tracker and I don’t know how to append it to list slot.
here is my custom code action.py
from rasa_core_sdk import Action
from rasa_core_sdk.events import AllSlotsReset, Restarted, SlotSet
class ActionSlotReset(Action):
def name(self):
return 'action_slot_reset'
def run(self, dispatcher, tracker, domain):
return [AllSlotsReset()]
class ActionRestarted(Action):
""" This is for restarting the chat"""
def name(self):
return "action_restart"
def run(self, dispatcher, tracker, domain):
return [Restarted()]
class ActionSlotSet(Action):
def name(self):
return "action_slot_set"
def run(self, dispatcher, tracker, domain):
answer = tracker.latest_message.get("text")
return [SlotSet("rearrange_answers", answer)]
class ActionCheckAnswer(Action):
def name(self):
return "action_check_answer"
def run(self, dispatcher, tracker, domain):
text = tracker.latest_message.get("text")
answers = tracker.get_slot("rearrange_answer_1").lower()
I don’t know how to set rearrange_answers
list slot from the user text message. Also, entity values are lost after action_listen
is executed every time during a story.