Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from rasa_core.actions.action import Action
from rasa_core.events 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")]
else:
return [SlotSet("gender", "others")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment