Use Entities For Watson Assistant Node Conditions

Leo Mazzoli
IBM Data Science in Practice
3 min readFeb 5, 2020

When evaluating “non-intent” user responses in Watson Assistant (WA), try to use entities instead of evaluating the contents of “input.text”. Entities are both reusable and not case sensitive, meaning you will get cleaner code.

Using “input.text” in WA is a great way to capture and save the input into a context variable for later use or for determining the length of what was said, but for dialog node conditions, it can directly short-cut some of WA’s capabilities and can become a maintenance nightmare.

For example, let’s say the user is asked “Would you like to receive your statement by mail or fax?”. If you use “input.text” to test the user response for the value of “mail” you will miss common variations.

  • The condition (input.text == “Mail”) ||(input.text == “mail”) doesn’t capture all case variations
  • The condition (Input.text.toLowerCase() = “mail”) is better for case sensitivity, but would not handle the situation where the utterance is something like “send it by mail”
  • In speech applications, mis-transcriptions (homonyms) are possible. Neither of the cases above would work if the utterance came to WA as “male”

Avoid these issues by setting up entities to capture key items in the utterance and configuring the node conditions to look for those entities.

Create Entity

WA Entities — My entities

Configure Dialog

WA Dialog

Using @deliveryPreference:mail for the condition…

  • Tests for the occurrence of “mail” in the utterance
  • Captures all synonyms of “mail” configured for the entity (ie “male”)
  • Is case insensitive
  • Ignores any additional words in the utterance

There are many uses for “input.text” and powerful string methods available that can be used to evaluate the object. However, when configuring node conditions, it’s good practice to try to use entities to simplify and organize your WA design.

We have built a workspace analyzer that detects “input.text” conditions at https://github.com/cognitive-catalyst/WA-Testing-Tool/. Download the tool and navigate to the ‘validate_workspace’ section. This will help you quickly discover these conditions and others that you may wish to improve.

Find more Watson Assistant Best Practices at https://medium.com/ibm-watson/best-practices-for-building-and-maintaining-a-chatbot-a8b78f0b1b72. For help implementing these practices, reach out to IBM Data and AI Expert Labs and Learning.

--

--

Leo Mazzoli
IBM Data Science in Practice

IBM Watson Cognitive Engineer specializing in conversational AI solutions. All views are my own. lmazzoli@us.ibm.com