Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from rasa_core.actions.action import Action
from import SlotSet
class ActionGender(Action):
def name(self):
return 'action_gender'
def run(self, dispatcher, tracker, domain):
messageObtained = tracker.latest_message.text.lower()
if ("male" in messageObtained):
return [SlotSet("gender", "male")]
elif ("female" in messageObtained):
return [SlotSet("gender", "female")]
return [SlotSet("gender", "others")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment