Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 2, 2020 06:25
Show Gist options
  • Save velotiotech/2d2ab0f5423b87a0c4722ffe1116ce29 to your computer and use it in GitHub Desktop.
Save velotiotech/2d2ab0f5423b87a0c4722ffe1116ce29 to your computer and use it in GitHub Desktop.
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