-->

Watson Conversation Dialogue, how to save user inp

2019-06-08 07:47发布

问题:

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?

回答1:

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

"context":{
"issue_description":"<?input.text?>"
}


回答2:

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.:| @\\']+[\"”“]"
          ]
        }
      ],
}


回答3:

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.