Multiple intents story uses first template and ignores remaining

rasa-nlu
rasa-core

(Muhammad Irfan) #1

All the things are working fine except templates in multiple intents stories.

here are the stories for multiple intents:

## blood pressure story 005
* add.blood_pressure{"systolic":"80", "diastolic":"90"}
    - slot{"systolic":"80"}
    - slot{"diastolic":"90"}
    - utter_add_blood_pressure
    - action_slot_reset
## blood pressure story 006
* add.blood_pressure{"systolic":"90","diastolic":"100"}
    - slot{"systolic":"90"}
    - slot{"diastolic":"100"}
    - utter_add_blood_pressure
    - action_slot_reset
## blood pressure + body temperature story 010
* add.blood_pressure+add.body_temperature
    - slot{"systolic":"90"}
    - slot{"diastolic":"110"}
    - slot{"temperature_value":"60"}
    - slot{"temperature_unit":"Celsius"}
    - utter_add_blood_pressure
    - utter_add_body_temperature
    - action_slot_reset
## blood pressure + body temperature story 011
* add.blood_pressure+add.body_temperature
    - slot{"systolic":"80"}
    - slot{"diastolic":"100"}
    - slot{"temperature_value":"48"}
    - slot{"temperature_unit":"Celsius"}
    - utter_add_blood_pressure
    - utter_add_body_temperature
    - action_slot_reset
## blood pressure + body temperature story 011
* add.blood_pressure+add.body_temperature
    - slot{"systolic":"80"}
    - slot{"diastolic":"100"}
    - slot{"temperature_value":"48"}
    - slot{"temperature_unit":"Celsius"}
    - slot{"temperature_method":"rectal"}
    - utter_add_blood_pressure
    - utter_add_body_temperature_with_method
    - action_slot_reset
## blood pressure + body temperature story 011
* add.blood_pressure+add.body_temperature
    - slot{"systolic":"90"}
    - slot{"diastolic":"110"}
    - slot{"temperature_value":"60"}
    - slot{"temperature_unit":"Celsius"}
    - slot{"temperature_method":"rectal"}
    - utter_add_blood_pressure
    - utter_add_body_temperature_with_method
    - action_slot_reset

here is the debug output:

2018-08-31 15:52:00 INFO     root  - Rasa process starting
2018-08-31 15:52:05 INFO     rasa_nlu.components  - Added 'nlp_spacy' to component cache. Key 'nlp_spacy-en'.
2018-08-31 15:52:05 WARNING  py.warnings  - /usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/extractors/entity_synonyms.py:85: UserWarning: Failed to load synonyms file from 'models/mecosProvider/current/mecosProviderModel/entity_synonyms.json'
  "".format(entity_synonyms_file))

2018-08-31 15:52:05.487628: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-08-31 15:52:05 INFO     tensorflow  - Restoring parameters from models/mecosProvider/current/mecosProviderModel/intent_classifier_tensorflow_embedding.ckpt
Using TensorFlow backend.
2018-08-31 15:52:06 WARNING  py.warnings  - /Users/mirfan/Library/Python/3.6/lib/python/site-packages/pykwalify/core.py:99: UnsafeLoaderWarning: 
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)

Bot loaded. Type a message and press enter: 
2018-08-31 15:52:06 INFO     root  - Finished loading agent, starting input channel & server.
blood pressure 100 by 120 body temperature 80
2018-08-31 15:52:21 DEBUG    rasa_core.tracker_store  - Creating a new tracker for id 'default'.
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Received user message 'blood pressure 100 by 120 body temperature 80' with intent '{'name': 'add.blood_pressure+add.body_temperature', 'confidence': 0.9497117400169373}' and entities '[{'start': 0, 'end': 14, 'value': 'blood pressure', 'entity': 'blood_pressure', 'confidence': 0.9551532728868418, 'extractor': 'ner_crf'}, {'start': 15, 'end': 18, 'value': '100', 'entity': 'systolic', 'confidence': 0.918480577698284, 'extractor': 'ner_crf'}, {'start': 22, 'end': 25, 'value': '120', 'entity': 'diastolic', 'confidence': 0.870325747837904, 'extractor': 'ner_crf'}, {'start': 26, 'end': 42, 'value': 'body temperature', 'entity': 'body_temperature', 'confidence': 0.9790170650810346, 'extractor': 'ner_crf'}, {'start': 43, 'end': 45, 'value': '80', 'entity': 'temperature_value', 'confidence': 0.7656223654944009, 'extractor': 'ner_crf'}]'
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 5 events
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Current slot values: 
	calendar: None
	command: None
	diastolic: 120
	head: None
	head_length: None
	height: None
	measure_unit: None
	medication: None
	number: None
	patient-name: None
	pulse_rate: None
	respiration_rate: None
	settings: None
	systolic: 100
	temperature_method: None
	temperature_unit: Celsius
	temperature_value: 80
	waist: None
	weight: None
	weight_unit: None
	weight_value: None
2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, None, {'slot_temperature_unit_0': 1.0}, {'entity_diastolic': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0, 'slot_diastolic_0': 1.0, 'slot_systolic_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'slot_temperature_value_0': 1.0, 'entity_blood_pressure': 1.0}]
2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'utter_add_blood_pressure' with prob 1.00.
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Action 'utter_add_blood_pressure' ended with events '[]'
Adding blood pressure systolic 100 diastolic 120.2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Bot utterance 'BotUttered(text: Adding blood pressure systolic 100 diastolic 120., data: null)'

2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, None, {'slot_temperature_unit_0': 1.0}, {'entity_diastolic': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0, 'slot_diastolic_0': 1.0, 'slot_systolic_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'slot_temperature_value_0': 1.0, 'entity_blood_pressure': 1.0}, {'entity_diastolic': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_diastolic_0': 1.0, 'slot_systolic_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'prev_utter_add_blood_pressure': 1.0, 'slot_temperature_value_0': 1.0, 'entity_blood_pressure': 1.0}]
2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_slot_reset' with prob 1.00.
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Action 'action_slot_reset' ended with events '['AllSlotsReset()']'
2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - Current tracker state [None, {'slot_temperature_unit_0': 1.0}, {'entity_diastolic': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'prev_action_listen': 1.0, 'slot_diastolic_0': 1.0, 'slot_systolic_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'slot_temperature_value_0': 1.0, 'entity_blood_pressure': 1.0}, {'entity_diastolic': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'slot_diastolic_0': 1.0, 'slot_systolic_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'prev_utter_add_blood_pressure': 1.0, 'slot_temperature_value_0': 1.0, 'entity_blood_pressure': 1.0}, {'entity_diastolic': 1.0, 'prev_action_slot_reset': 1.0, 'entity_body_temperature': 1.0, 'slot_temperature_unit_0': 1.0, 'entity_systolic': 1.0, 'intent_add.blood_pressure+add.body_temperature': 1.0, 'entity_temperature_value': 1.0, 'entity_blood_pressure': 1.0}]
2018-08-31 15:52:21 DEBUG    rasa_core.policies.memoization  - There is no memorised next action
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action using policy_1_KerasPolicy
2018-08-31 15:52:21 DEBUG    rasa_core.policies.ensemble  - Predicted next action 'action_listen' with prob 1.00.
2018-08-31 15:52:21 DEBUG    rasa_core.processor  - Action 'action_listen' ended with events '[]'

templates:

 utter_add_body_temperature:
 - "Adding body temperature {temperature_value} {temperature_unit}."
 utter_add_body_temperature_with_method:
 - "Adding body temperature {temperature_value} {temperature_unit} temperature method {temperature_method}."
 utter_add_blood_pressure:
 - "Adding blood pressure systolic {systolic} diastolic {diastolic}."

Iā€™m stuck in this loop.


(Akela Drissner) #2

You need to add these entities to the multi intents as well, as you have done for the single intents


(Muhammad Irfan) #3

it throws following error when entities added to multiple intents for stories like this:

* add.blood_pressure{"systolic":"90","diastolic":"110"}+add.body_temperature{"temperature_value":"60","temperature_unit":"Celsius", "temperature_method":"oral"}+add.pulse{"pulse_rate":"50"}
- slot{"systolic":"90"}
- slot{"diastolic":"110"}
- slot{"temperature_value":"60"}
- slot{"temperature_unit":"Celsius"}
- slot{"temperature_method":"oral"}
- slot{"pulse_rate":"50"}
- utter_add_blood_pressure
- utter_add_body_temperature
- utter_add_pulse
- action_slot_reset

- Invalid to parse arguments in line 'add.blood_pressure{"systolic":"90","diastolic":"110"}+add.body_temperature{"temperature_value":"60","temperature_unit":"Celsius", "temperature_method":"oral"}+add.pulse{"pulse_rate":"50"}'. Failed to decode parametersas a json object. Make sure the intentfollowed by a proper json object. Error: Extra data: line 1 column 36 (char 35)


(Akela Drissner) #4

Because the + is part of the intent name, you need to add all picked up entities at the end of the intent name, like this:

add.blood_pressure+add.body_temperature+add.pulse{"pulse_rate":"50", "systolic":"90","diastolic":"110", "temperature_value":"60","temperature_unit":"Celsius", "temperature_method":"oral"}


(Muhammad Irfan) #5

Got it. Thanks!!