The duckling option to entity() specifies that the integrated Duckling library will be used for the matching of the message.

Duckling supports extraction of various entities like phone numbers, email addresses, dates, et cetera.

@email entity(duckling: "email")
@time  entity(duckling: "time", locale: "nl_NL", timezone: "UTC")


Duckling matchers are locale and time zone sensitive. By default, the locale is en_US and the default time zone is Europe/Amsterdam.

Duckling extraction supports the following entities:

  • email
  • amount_of_money
  • phone_number
  • url
  • distance
  • duration
  • number
  • ordinal
  • quantity
  • temperature
  • time
  • volume

Matchers defined as entity() constants can be used as matchers in both dialog as well as ask:

# Define an duckling entity:
@email entity(duckling: "email")

dialog trigger: @email do
  say "Thank you for your email! You entered: #{entity.value}"

dialog ask do
  entity = ask "What is your email?", expecting: @email
  say entity.value

The fields of the entity variable that Duckling returns are:

  • value - the parsed value
  • grain - for date / time values, the granularity of the result, e.g. day, hour, minute.
  • text - the part of the sentence that matched. When the input is "My email address is", the text will be filled with "".