IBM Watson Slots does not accept 0

I tried the slots feature in IBM Watson Conversations and got into a problem and I'm not sure how to work.

I have a use case that collects several pieces of information from the user, so using the Slots function makes sense. Unfortunately, when I add a slot with @ sys-number, the system will not accept 0 as valid input. This slot is actually required, but 0 is a valid value.

Does anyone have an idea how to have a required slot like @ sys-number that takes 0 as a value?

+3


source to share


2 answers


A condition @sys-number

is actually short syntax for a condition entities['sys-number'].value

. When dispatched 0

, the condition is evaluated as false

because it is 0

treated as false

an expression language evaluator in the Wasson Conversation Service. Now this is not the desired behavior in this case. To prevent this from happening, you can use it entities['sys-number']

in a state that will return true

every time an object is @sys-number

recognized as input.

When using this in a slot, you can edit what is stored in the context variable, since changing the condition will also change what is stored in the variable. This can be done using the JSON editor - click the "set slot" button next to the slot specification and in the window that opens, click the three dots, open the JSON editor and change what is actually stored inside the context variable that is updated by the slot.



Here is a link to the system object in the Watson Conversation Service documentation .

+2


source


I had a similar problem with the recognition of null values in the slots and documentation system entities did not explain it well enough (for me at least).

Further elaborating on Michal's answer above:

  • Click the Change Slot button (gear icon)
  • Set the "Check for" attribute in the slot condition as entities['sys-number']

change slot modal

  1. Select Modal Slot Edit Menu Options (three bubbles in the corner)
  2. Open the JSON editor
  3. Change the value of the context variable to "<?entities['sys-number'].value ?>"



edit json slot editor


Result:

result

0


source







All Articles