Test a regular expression slot type
You can test expressions when you create regular expression slot types in Genesys Dialog Engine Bot Flows and Genesys Digital Bot Flows before or after you publish the flow.
When you create slot types, the Test Utterance field enables you to create a sample utterance, test the utterance, and then find new or existing regular expressions that highlight any matches to the utterance text. This process alleviates the need to use third-party tools to create and test expressions and can also provide insight about how best to use these expressions in your bot flows.
- The bot evaluates regular expression matches from top to bottom. For example, if the third, fourth, and sixth rows in your regular expression list match the sample utterance, the bot only highlights and uses the third row.
- If more than one element of a test utterance is a potential match for an expression, the last matched element takes priority. For example, if the test string contains three matches, the bot chooses the match nearest to the end of the string.
- If you save your regular expression, then the last matching test utterance and the regular expression both appear in a yellow highlight.
- If you do not save your regular expression or you leave it in edit mode, then a matching test utterance appears in a blue highlight.
Test a sample utterance against a regular expression
To test a sample utterance against a regular expression, follow these steps:
- Open an existing bot flow or digital bot flow, or create a new one.
- Under Natural Language Understanding, click Slots.
- Click Add Slot.
- Provide a meaningful name for the slot. For example, ZipCodeLocations.
- Under Associated Slot Type, click New RegEx.
- Type a meaningful name for the custom RegEx slot type; for example, Zip Code. If you do not type a name, Architect adds one for you.
- Click Save.
- Click the new RegEx slot type.
- Add one or more regular expression slot type values. For example,
- In the Test Utterance box, type an example string that you want to match to a regular expression. For example, “What is the closest recording studio to 46167?” Note: If the bot flow finds a match, it highlights the utterance match and the saved regular expression in yellow, or it highlights the utterance match to an unsaved regular expression in blue.