Friday, September 21, 2018

More tricks for building chatbots with IBM Watson Assistant

Have you heard? New tips and tricks!
If you are building chatbots with IBM Watson Assistant (Conversation), then you might have already stumbled over my collection of tips and tricks or my command line tool for testing chatbots. Earlier today I updated the tips and tricks and added section on collection projection. If you know SQL and relational algebra, then you know the concept of projection. The same can be applied to JSON data and used within Watson Assistant dialogs.

Collection Projection

The projection operator is denoted by an exclamation mark ("!") and can be used as follows:

{ "text": "<? entities['myentity'].![value] ?>"}

The above would print array of all the detected entity values for "myentity". For a message like "I am looking forward to an ice-cold beer and some pizza after work" the output could be as follows, listing the detected meal categories:

["drink", "food"]

The projection operator comes handy when applied together with the string join function or to preprocess data coming from a database like Db2 (see this tutorial on a database-driven chatbot). Find out more by visiting the collection of tips and tricks and the linked references.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.