Search code examples
chatbotibm-watsonwatson-conversationspring-el

How to detect if user input have one word only in Watson Assistant?


I am using the IBM Watson Conversation Assistant Chatbot. I am having troubles finding in the documentation how to detect if the user input consists of a single word. It's fine for simplicity and for my goal to use the presence of spaces as surrogate (no spaces means only word).

I tried using SpEL. I tried also to intercept the following as Node entry:

request.input.text:" "

with scarce results.

What should I write into the "If assistant recognizes:" field?


Solution

  • Here how I solved, hopefully will save a lot of time to someone else.

    Inside the node, under "If assistant recognizes:"

    !input.text.contains(' ')
    

    Then respond with:

    You wrote  "<? input.text ?>". Please write full sentences.