Not getting proper response after adding Duckling

Hi

I have installed duckling on my machine and added pipeline in my config file but after that too I am unable to get numerals from alphabets on my chatbot. Like if I write One it sends me One and not 1. But when I type it on terminal using curl it sends me value as 1, Can anyone help me with this issue?

can you share your config?

did you label the duckling entities in your training data? - you should not otherwise, the entities you receive are coming from ner_crf

Hi, @souvikg10, This is my config file and I have not label the duckling entitites in my training data.

language: "en"
path: "./model/nlu"
data: "./data/data.json"
pipeline: 
- name: "tokenizer_whitespace"
- name: "intent_entity_featurizer_regex"
- name: "ner_crf"
- name: "ner_synonyms"
- name: "intent_featurizer_count_vectors"
- name: "intent_classifier_tensorflow_embedding"
  intent_tokenization_flag: true
  intent_split_symbol: "+"
- name: "ner_duckling_http"
  url: "http://0.0.0.0:8000"
  dimensions: ["number", "amount-of-money"]
  locale: "en_US"

Are you sure your ner_crf don’t have the same entity name?

and maybe debug if duckling is actually being called or not from rasa nlu… how did you install duckling? the haskell way or docker?

I installed duckling by haskell way and my ner_conf don’t have the same entity name.

Can you send me an example what you send to Rasa NLU along with the request format, I will try to recreate your config and test because it all seems alright

Hi,

Sorry for late reply, My duckling is working but I am unable to extract values from duckling. e.g. When entering values like ten it is setting values as ten but I want to set it as 10 in my slots. Can you help me with that?

What are you sending to Rasa NLU ? Send the request format and the response from NLU

I am sending you request as well as response from bot under --debug flag

fifty
2018-12-04 14:53:14 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default'
2018-12-04 14:53:14 DEBUG    rasa_core.processor  - Received user message 'fifty' with intent '{'name': None, 'confidence': 0.0}' and entities '[{'start': 0, 'end': 5, 'value': 'fifty', 'entity': 'amount', 'confidence': 0.24789153752463391, 'extractor': 'ner_crf'}, {'start': 0, 'end': 5, 'text': 'fifty', 'value': 50, 'confidence': 1.0, 'additional_info': {'value': 50, 'type': 'value'}, 'entity': 'number', 'extractor': 'ner_duckling_http'}]'
2018-12-04 14:53:14 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 50 events
2018-12-04 14:53:14 DEBUG    rasa_core.processor  - Current slot values: 
	amount: fifty
	confirmation: None
	currency_conversion_rate: 100.0
	userId: None
	validation: valid

I want my amount_slot to be set as 50 not fifty.

Like i said before, you have annotated your training examples with amount but you want a number from duckling

the amount slot is set using ner_crf and not using duckling because the entity provided by duckling is called number and not amount which is why you get fifty and not 50 .

First remove annotations of your NLU training data for amount entity(this entity is getting trained using crf) retrain your NLU, make sure there is no entity named amount

add a new slot of type float called number the same as the entity name duckling is setting, use a custom action to SlotSet(amount, number)

Hey,

If I don’t defined number in my custom action file will it not show number not defined error when I execute my custom action or else I didn’t get you point can you explain a bit more.

you should have a slot named number in domain.yml file

and in your story, the state where the number is caught, you will call the custom action to extract the number slot and use the value to fill the amount slot

Yeah I have already done but when calling custom action it is showing number is not defined

domain.yml:

slots:
     number:
             type: float
entities:
     - number


actions.py

class ActionAmount(Action):
  def name(self):
        return "action_bet_amount"

  def run(self,dispatcher,tracker,domain):
         ------------------------
         ------------------------
         return [SlotSet("amount", number)]

how did you extract number in your custom action? tracker.get_slot?

Yes, I have provided and It is showing this:

Fifty
2018-12-05 10:32:17 DEBUG    rasa_core.tracker_store  - Recreating tracker for id 'default'
2018-12-05 10:32:17 DEBUG    rasa_core.processor  - Received user message 'Fifty' with intent '{'name': None, 'confidence': 0.0}' and entities '[{'start': 0, 'end': 5, 'value': 'Fifty', 'entity': 'bettype', 'confidence': 0.7557516117389612, 'extractor': 'ner_crf'}, {'start': 0, 'end': 5, 'text': 'Fifty', 'value': 50, 'confidence': 1.0, 'additional_info': {'value': 50, 'type': 'value'}, 'entity': 'number', 'extractor': 'ner_duckling_http'}]'
2018-12-05 10:32:17 DEBUG    rasa_core.processor  - Logged UserUtterance - tracker now has 36 events
2018-12-05 10:32:17 DEBUG    rasa_core.processor  - Current slot values: 
	amount: None
    type: Fifty

You have to retrain your models and reset your tracker first. Your debug still shows old values. Because there are no slots named number.

What are you using in your custom action and which version of Rasa core are you in?

I am giving you modified details because of privacy issue here I am getting number slot and my model is retrained and I am using rasa_core = 0.12.2

What is the code you wrote to extract number from tracker

number = tracker.get_slot("number")
return [SlotSet("amount", number)]

in custom_action and set number in slots in domain file.

and you are receiving an error,

when you debug do you see the entity number being set? Maybe change the slot value type to “text”. i guess because the slot type is float, it isn’t getting picked as a slot, since duckling slot type could be integer or text

my mistake, i assumed it should pick up float in the slot itself