Training with Duckling

I’m attempting to train a bot that uses Duckling to identify numbers and times. I had previously created the following entity slots:

  - number
  - timeAbs
  - timeAgo
  - yearBorn
  - zipCode
  - time

Duckling seems to find entities of its own that are called similar things. When I train interactively with Duckling and append the resulting data from the session, Duckling is creating synonyms and data that are tagged to specific times and numbers:

 [around noon](time:2019-05-02T12:00:00.000-07:00)[noon](timeAbs)

Do you recommend that we rely only upon Duckling for training? It seems that Rasa NLU entities are decoupled completely from Duckling entities, and that Duckling does not feed features to Rasa NLU entity prediction. However, if we use Duckling entities only for training, we end up with these ultra-specific times assigned to the entities.

Finally, I want to confirm that all discovered Duckling entities must also be listed under “domain.yml”'s entities listing (i.e. time, number), or is this unnecessary?

So entities extracted by duckling shouldn’t be labeled in your training data. I think we fixed that in interactive learning either in 0.15.0 or in the latest master. We would advise you rely on duckling to extract time, becasue it’s a lot more robust than trying to get the crf to extract them. You can post process these entities in a custom action if needed.

And yes, you should list any entities you want duckling to extract in your domain file. You can also restrict the ones that should be extracted in the dimensions section in your nlu config file

Continuing the discussion from Training with Duckling:

Dear Akela @akelad ,

Could you provide an example on how to access the entities of duckling to include them in my utter respones.

So for example, when the user says: ,On the 10th of June", the chatbot should respond with ,You provided the: {2019-07-10…}.

How would I have to setup my utter responses in the domain.yml file?

Many thanks in advance

Given that the Duckling calls extracted entity time, you could just declare a slot called time. Slots are automatically populated with the entities of the same name.

Now, you are free to use this value in the template like any other slot. In essence:

        - text: "You said: {time}"
1 Like

Thank you for your response Akshay!

However I’m unfortunately not able to retrieve the value.

My contains the following:



and domain.yml:

However, when testing in rasa shell it still does not work:

I though perhaps because time is a duckling entity, I don’t need to declare it manually in the domain.yml file. However, this made no difference…

Do you have any suggestions? Or am I missing something?

Thanks in advance!

Can I see the NLU pipeline configuration and the logs please? Is your Duckling server running?

Also, the value returned by Duckling is not a string. So setting slot type to text my be causing an issue. Try unfeaturized?

Lastly, I would still recommend making the custom action and handling the value over there. I’m assuming you’ll need to go that route eventually anyway.

Dear Akshay,

Sorry for the late response. It seems to be working now. Apparently something went wrong while trainig the model. After some retraining and a reboot of the system it worked. Thanks a lot for you help!

Best regards,