Extract date

Hello, I am trying to create a booking bot. I have created a formaction and I am trying to extract date. I added words “tommorow” and “today” in many examples, in data.json and in train interactive but the bot doesn’t extract the entity. I would like also the bot to understand dates like “2 of January” or “first of february”. I searched in google and in docs but I cannot find an example or documentation how to do it.

Thank you very much

Hi, Did you try the duckling in the pipeline?

No I haven’t. But how to I use it? Can I use it inside Formaction? Is there an example I can see? Thank you

First, You have to include it in the NLU pipeline like this

pipeline:
- name: "ner_duckling_http"
  # url of the running duckling server
  url: "http://localhost:8000"
  # dimensions to extract
  dimensions: ["time", "number", "amount-of-money", "distance"]
  # allows you to configure the locale, by default the language is
  # used
  locale: "de_DE"
  # if not set the default timezone of Duckling is going to be used
  # needed to calculate dates from relative expressions like "tomorrow"
  timezone: "Europe/Berlin"

This allows the NLU config to parse the incoming to look for dates amongst other dimensions. This will give you time dimension and return time in the entities. You can then create a time slot to save it and extract it through custom actions

Ok, thank you very much. Last question… is it possible to have multiple pipelines? Now I have spacy_sklearn I think. I am reading about pipelines but I am not so sure yet how they work exactly.

you can have multiple components in the pipeline ,

the pipeline spacy_sklearn is a combination of multiple components, you can check here

You can check what spacy_sklearn contains in terms of components. What you can do is add new components to the pipeline

language: "en"

pipeline:
- name: "nlp_spacy"
- name: "tokenizer_spacy"
- name: "intent_entity_featurizer_regex"
- name: "intent_featurizer_spacy"
- name: "ner_crf"
- name: "ner_synonyms"
- name: "intent_classifier_sklearn"
- name: "ner_duckling_http"
  # url of the running duckling server
  url: "http://localhost:8000"
  # dimensions to extract
  dimensions: ["time", "number", "amount-of-money", "distance"]
  # allows you to configure the locale, by default the language is
  # used
  locale: "de_DE"
  # if not set the default timezone of Duckling is going to be used
  # needed to calculate dates from relative expressions like "tomorrow"
  timezone: "Europe/Berlin"

The pipelines are executed in sequence, so if you have for example a featurizer it should be passed before the classifier if the components are given to the classifier

thank you very much!!!