Search code examples
ibm-cloudibm-watsonwatson-conversation

IBM Watson Assistant: How to get just few numbers with System entities sys-number


I have some Business rule to follow.

I need to request for the user one Year, and currently, I'm using @sys-number to get the Year and other data if need numbers.

I want to know if have some form to get the @sys-number with just 4 digits, like: Watson: What the year, please? Format example: - 2017

  • User say: the year is 17 (@sys-number get the 17 fine)

  • User say: the year is 2017 (@sys-number get the 2017 fine)

I need: ONLY If the user types the 4 numbers from the year, the condition @sys-number[4] //I don't know will get the year correctly and the Conversation will flow.

My condition currently within the node is:

  • if bot recognizes @sys-number

Solution

  • You could use two predicates:
    if @sys-number and @sys-number>1000 The first would make sure that really a number was entered, the second predicate would take care of 4 digits. You could even add another predicate and limit the range of valid years.