RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.88k stars 4.63k forks source link

Slots and intents not being identified #2448

Closed rkkumar16 closed 5 years ago

rkkumar16 commented 6 years ago
**Rasa Core version**: 0.11 **Python version**: 3.6 **Operating system** (windows, osx, ...): windows 7 **Issue**: Using code from documentation I tried to handle a channel from user input. When I train the NLU then I get proper intent and entity recognition but when I try same with rasa_core it does not recognize the entities and intents are also not identified. As a result no slot is filled. ``` def run(serve_forever=True): input_channel = SimpleWebBot() if serve_forever: agent.handle_channels( [input_channel], 5001 ) return agent if __name__ == "__main__": run() ``` **Content of domain file** (if used & relevant): ```yaml slots: user_mail: type: text bot_action: type: text cancel_type: type: text cancel_from: type: text cancel_upto: type: text entities: - user_mail - bot_action - cancel_type - cancel_from - cancel_upto - htype intents: - start_bot - get_mail - trip_cancel - trip_type - get_from_date - get_to_date actions: - utter_greet - utter_ask_email - utter_bot_action - utter_cancel_options - utter_cancel_from - utter_cancel_upto - utter_cancel_result templates: utter_greet: - text: "Hi, I'm Helpbot. How may I help you?" utter_ask_email: - text: "Can you please enter your email ID" utter_bot_action: - text: "Hi {user_mail}! How may I help you on trip cancellation. Pls opt one of the below options" buttons: - title: "Trip cancellation" payload: "Trip cancellation" - title: "Log a feedback" payload: "Log a feedback" utter_cancel_options: - text: "Hi {user_mail}! How may I help you on trip cancellation. Please select one of the below options" buttons: - title: "cancel pick" payload: "cancel pick" - title: "cancel drop" payload: "cancel drop" utter_cancel_from: - text: "OK. We will help you the cancellation. Pls mention from date in DD/MM/YYY format. For single day cancellation from and to date will be same" utter_cancel_upto: - text: "OK. Pls mention upto date in DD/MM/YYY format. For single day cancellation from and to date will be same" utter_cancel_result: - text: "Hi, {user_mail}! Your trip has been cancelled for the requested date." ``` stories.md * start_bot - utter_ask_email * get_mail{"user_mail": "xyz@gmail.com"} - utter_bot_action * trip_cancel{"bot_action": "Trip Cancel"} - utter_cancel_options * trip_type{"cancel_type": "pick up"} - utter_cancel_from * get_from_date{"cancel_from": "27/11/2018"} - utter_cancel_upto * get_to_date{"cancel_upto": "27/11/2018"} - utter_cancel_result - action_restart **nlu.md** ## intent:start_bot - Hi - Hi - Hii - Hii - awake - Hey - Hey - Hello - Hello ## intent:get_mail - My email is [abc@gmail.com](user_mail) - My email is [saket.kumar@yahoo.com](user_mail) - My email is [testmail@remail.com](user_mail) - My email is [dummy@email.in](user_mail) - My email is [m@yahoo.in](user_mail) - My email is [what@dex.com](user_mail) - My email is [testmail@testmail.com](user_mail) - My email is [Myname@in.com](user_mail) - My email is [My@gmail.com](user_mail) - My email is [My@mail.com](user_mail) - My email is [My@dummy.in](user_mail) - My email is [My@whyme.com](user_mail) - [rahul.kumar@yahoo.com](user_mail) is my email address - [user.name@gmail.com](user_mail) is my email address ## intent:trip_type - [cancel pick](cancel_type) - [cancel pick](cancel_type) - [cancel pick](cancel_type) - [cancel both](cancel_type) - [cancel both](cancel_type) - [cancel both](cancel_type) - [cancel drop](cancel_type) - [cancel drop](cancel_type) - [cancel drop](cancel_type) ## intent:bot_action - [Trip Cancellation](action_type) - [Trip Cancellation](action_type) - [Log a feedback](action_type) - [Log a feedback](action_type) ## intent:need_help - Need help - Need to contact - Help required - How can I get help ## intent:get_from_date - from [27/11/2018](cancel_from) - From [7/11/2018](cancel_from) - from [2/11/2018](cancel_from) - From [27/1/2018](cancel_from) - From [27/11/2016](cancel_from) - From [27/11/2012](cancel_from) - from [27/11/2011](cancel_from) - From [27/11/2010](cancel_from) - From [27/11/2015](cancel_from) - From [27/11/2014](cancel_from) ## intent:get_to_date - to [28/11/2018](cancel_upto) - upto [28/11/2018](cancel_upto) - Till [28/11/2018](cancel_upto) - Uptill [28](cancel_upto) - Next [28](cancel_upto) - coming [Monday](cancel_upto) ## regex:email - My email is .+ **Logs for the code are** ``` The default 'Loader' for 'load(stream)' without further arguments can be unsafe. Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK. Alternatively include the following in your code: import warnings warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning) In most other cases you should consider using 'safe_load(stream)' data = yaml.load(stream) Using TensorFlow backend. 2018-08-29 13:31:14 DEBUG rasa_core.tracker_store - Creating a new tracker for id '233'. 2018-08-29 13:31:14 DEBUG rasa_core.processor - Received user message 'Hi' with intent '{'name': 'Hi', 'confidence': 1.0}' and entities '[]' 2018-08-29 13:31:14 DEBUG rasa_core.processor - Logged UserUtterance - tracker now has 2 events 2018-08-29 13:31:14 DEBUG rasa_core.processor - Current slot values: bot_action: None cancel_from: None cancel_type: None cancel_upto: None user_mail: None 2018-08-29 13:31:14 DEBUG rasa_core.policies.memoization - Current tracker state [{}, {'prev_action_listen': 1.0, 'intent_Hi': 1.0}] 2018-08-29 13:31:14 DEBUG rasa_core.policies.memoization - There is no memorised next action 2018-08-29 13:31:14 DEBUG rasa_core.featurizers - Feature 'intent_Hi' (value: '1.0') could not be found in feature map. Make sure you added all intents and entities to the domain 2018-08-29 13:31:14 DEBUG rasa_core.policies.ensemble - Predicted next action using policy_1_KerasPolicy 2018-08-29 13:31:14 DEBUG rasa_core.processor - Predicted next action 'action_listen' with prob 0.99. 2018-08-29 13:31:14 DEBUG rasa_core.processor - Action 'action_listen' ended with events '[]' 192.168.54.44 - - [2018-08-29 13:31:14] "POST /chat/ HTTP/1.1" 200 110 0.091000 ``` Please look into the issue and suggest some solution for this.
rkkumar16 commented 6 years ago

I finally fixed this issue by changing the interpreter. earlier i was using it like this

interpreter = Interpreter.load("./project/default/current")
agent = Agent.load(utils.CORE_MODEL,interpreter=interpreter)

Now I changed it to

interpreter = Interpreter.load("./project/default/current")
agent = Agent.load(utils.CORE_MODEL,interpreter=RasaNLUInterpreter("./project/default/current"))

Though I could not figure out the reason behind this. But it works

akelad commented 6 years ago

Because the RasaNLUInterpreter is required to load an NLU model, the other Interpreter acts as a regex