Skip to main content

Text Matching mode and Normalize Text before Matching

The Text Matching mode is the logic to use for comparing the bot response to the utterance (see capability).

Let’s say, your bot is answering a question for an order number with this text:

Your order number is PO-15342

When using text matching mode Substring matching, this BotiumScript will succeed:

#bot
Your order number is

And this one as well:

#bot
order number

As long as the bot response includes the snippet from BotiumScript, it is fine.

There is also the option to switch off the case sensitivity.

Using the text matching mode wildcard, you can introduce simple wildcard matching in your assertions by using the asterisk - so this one will succeed:

#bot
Your order number is *

And this one as well:

#bot
Your order number is PO-*

There is also the option to switch off the case sensitivity, which is the default if nothing else is selected.

Using the text matching mode regular expressions, assertion only succeeds if the BotiumScript snippet interpreted as regular expression is matching the bot response.

For example, you can assert that the order number follows your conventions:

#bot
Your order number is PO-[0-9]+

Recommending this tool to quick test regular expressions.

Using the Normalize Text before Matching option you can simplify the bot response before doing the assertions, to make it easier to compose regular expressions or substring patterns. HTML tags are removed, line breaks are removed, non printable characters are removed, … (for details, you can inspect the Convo.js#L456" Botium Core code).

Your bot is now returning a more sophisticated answer:

Your order number is <a href="my-site/show/15342">PO-15342</a>

&gt; <a href="my-site/show/15342">Show PO</a>
&gt; <a href="my-site/show/15342/items">Show Items</>

The Substring matching examples from above will continue to work, but the regular expression certainly won’t. When using the Normalize Text before Matching option, this bot response is converted to this text before the matching is done:

Your order number is PO-15342 > Show PO > Show Items

No line breaks, no HTML tags, no HTML entities. The BotiumScript snippets from above will continue to work.

Was this article helpful?

0 out of 0 found this helpful