1

Context: The Watson Conversation bot has a node that gets triggered by three input entities from the user, this works fine, but i want the reply from the bot to be

"Checking if you have a lecture tomorrow. Give me a moment"

then there's a query in the background building up the answer that gets replied later to the user.

the strong word tomorrow is an @sys-date entity, but i want it to reply to the user what he/she said instead of the date, because the bot can check no both weeks months ect, all valid date formats, and the reply would look much better if i could use the original text from the user.

This kind of origin retrieval will be used for other entities aswell when i get it working.

Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53

1 Answers1

3

You can use the context variable in the case, and if you want to get specific data, you can use regex to extract the user input:

Example all user input

"date": "<? input.text?>"

or for exactly what the user input, ex: "this week"

 "date": "<?@sys-date.literal?>"

Etc..

Use the variable with the .literal, see my complete example:

        {
  "context": {
    "date": "<?@sys-date.literal?>"
  },
  "output": {
    "text": {
      "values": [
        "Checking if you have a lecture $date. Give me a moment."
      ],
      "selection_policy": "sequential"
    }
  }
}

Documentation examples : enter image description here

Sayuri Mizuguchi
  • 5,250
  • 3
  • 26
  • 53
  • The problem for me is that there are 3 entities in the text input, and filtering it to only extract the part of the input that is assigned to the @sys-date entity is not possible that way. If i change the trigger the whole node would be useless, since the user can by sending simple inputs walk through a dialog-tree and get the same result. The purpose of this node is that the user can trigger the right output with only one input instead of having to walk 3 steps into another dialogtree – Nicolai Berg Jan 27 '17 at 12:34
  • You can edit and add the part of conversation? Because that way I can understand better. I think in the case, we can solve with entity .. but I need to see to be sure – Sayuri Mizuguchi Jan 27 '17 at 12:36
  • Input: do i have a lecture **this week** ? gives: Ok, checking if you have a lecture **2017-01-22**. Give me a minute please. Wanted result: Ok, checking if you have a lecture **this week**. Give me a minute please. – Nicolai Berg Jan 27 '17 at 12:42
  • Watson must have backend logic analyzing the input so it has the origin value for sys.date stored, but the problem is retrieving this origin value back and using it as output in my reply back to the user – Nicolai Berg Jan 27 '17 at 12:44