Watson Conversation Dialogue, how to save user inp

2019-06-08 08:03发布

In my Watson conversation dialogue am trying to read user input using slot, my requirement is to prompt user for enter an issue description and save it in a variable named issue_description.

but in slot, watson check for intent or entity before saving it into a variable. in my case i have put an intent to check with, but it is not saved into variable after the check, i always get true as issue_description.

how can i save the issue _description into a variable?

what should be the possible intent and entity for this?

3条回答
男人必须洒脱
2楼-- · 2019-06-08 08:20

To store the user input as in the context variable issue_description, you can either use an intent if you are not validating the input (description) or you can use an entity with the synonym value based on pattern. By doing this, you can configure the bot to recognize the condition and save the value to the context variable.

enter image description here

查看更多
太酷不给撩
3楼-- · 2019-06-08 08:32

To capture something like a description in a slot, my recommendation is to

  • define an entity based on a pattern that describes how the description should be.
  • in the pattern, you could use quotes as delimiter of the string to capture
  • in the slot definition Watson has to look for that entity, you provide the name of a context variable the entity value is saved to
  • access the context variable to process the captured value

There is a sample workspace I wrote that captures an event description using a pattern. In the dialog I cut the quotes off the string and then send it to a function for postprocessing. The eventName is defined as follows, the pattern in patterns is the interesting part:

{
      "entity": "eventName",
      "values": [
        {
          "type": "patterns",
          "value": "shortname",
          "created": "2018-01-31T13:28:56.245Z",
          "updated": "2018-02-07T09:08:31.651Z",
          "metadata": null,
          "patterns": [
            "[\"„“][A-Za-z0-9.:| @\\']+[\"”“]"
          ]
        }
      ],
}
查看更多
一夜七次
4楼-- · 2019-06-08 08:34

If you want to save user input then you can use to save the input in any variable.

"context":{
"issue_description":"<?input.text?>"
}
查看更多
登录 后发表回答