Created
July 2, 2020 06:25
-
-
Save velotiotech/2d2ab0f5423b87a0c4722ffe1116ce29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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