this is my dictionary :
rules = {‘I want (.*)’:
['What would it mean if you got {0}',
'Why do you want {0}',
"What's stopping you from getting {0}"],
'do you remember (.*)': ['Did you think I would forget {0}',
"Why haven't you been able to forget {0}",
'What about {0}',
'Yes .. and?'],
'do you think (.*)': ['if {0}? Absolutely.', 'No chance'],
'if (.*)': ["Do you really think it's likely that {0}",
'Do you wish that {0}',
'What do you think about {0}',
'Really--if {0}']
}
my action is :
lass ActionMatchWord(Action): def name(self) -> Text: return “action_match_word”
def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
message = ((tracker.latest_message)['text'])
response, phrase = "default", None
for pattern, responses in rules.items():
match = re.search(pattern,message)
if match is not None:
response = random.choice(responses)
if '{0}' in response:
phrase = match.group(1)
#final_mesg = " {0} {1} ".format(response,phrase)
dispatcher.utter_message(str(response)+ '' + str(phrase))
return []
when I use rasa shell I receive that msg.
those are the answers why the 0 stay there :
if {0}? Absolutely. you are cute Your input -> do you think you are smart enough
if {0}? Absolutely.you are smart enough
Your input -> if you want
Do you wish that {0}you want
Your input -> if you want to be here
Do you wish that {0}you want to be here
Your input -> if you bealive that
Really–if {0}you bealive that