GETTING STARTED
Kore.ai XO Platform
Virtual Assistants Overview
Natural Language Processing (NLP)
Concepts and Terminology
Quick Start Guide
Accessing the Platform
Navigating the Kore.ai XO Platform
Building a Virtual Assistant
Help & Learning Resources
Release Notes
Current Version
Recent Updates
Previous Versions
CONCEPTS
Design
Storyboard
Overview
FAQs
Conversation Designer
Overview
Dialog Tasks
Mock Scenes
Dialog Tasks
Overview
Navigate Dialog Tasks
Build Dialog Tasks
Node Types
Overview
Intent Node
Dialog Node
Dynamic Intent Node
GenAI Node
GenAI Prompt
Entity Node
Form Node
Confirmation Node
Message Nodes
Logic Node
Bot Action Node
Service Node
Webhook Node
Script Node
Process Node
Agent Transfer
Node Connections
Node Connections Setup
Sub-Intent Scoping
Entity Types
Entity Rules
User Prompts or Messages
Voice Call Properties
Knowledge AI
Introduction
Knowledge Graph
Introduction
Terminology
Build a Knowledge Graph
Manage FAQs
Knowledge Extraction
Import or Export Knowledge Graph
Prepare Data for Import
Importing Knowledge Graph
Exporting Knowledge Graph
Auto-Generate Knowledge Graph
Knowledge Graph Analysis
Answer from Documents
Alert Tasks
Small Talk
Digital Skills
Overview
Digital Forms
Digital Views
Introduction
Widgets
Panels
Session and Context Variables
Context Object
Intent Discovery
Train
NLP Optimization
ML Engine
Overview
Model Validation
FM Engine
KG Engine
Traits Engine
Ranking and Resolver
Training Validations
NLP Configurations
NLP Guidelines
LLM and Generative AI
Introduction
LLM Integration
Kore.ai XO GPT Module
Prompts & Requests Library
Co-Pilot Features
Dynamic Conversations Features
Intelligence
Introduction
Event Handlers
Contextual Memory
Contextual Intents
Interruption Management
Multi-intent Detection
Amending Entities
Default Conversations
Conversation Driven Dialog Builder
Sentinment Management
Tone Analysis
Default Standard Responses
Ignore Words & Field Memory
Test & Debug
Overview
Talk to Bot
Utterance Testing
Batch Testing
Conversation Testing
Conversation Testing Overview
Create a Test Suite
Test Editor
Test Case Assertion
Test Case Execution Summary
Glossary
Health and Monitoring
NLP Health
Flow Health
Integrations
Actions
Actions Overview
Asana
Configure
Templates
Azure OpenAI
Configure
Templates
BambooHR
Configure
Templates
Bitly
Configure
Templates
Confluence
Configure
Templates
DHL
Configure
Templates
Freshdesk
Configure
Templates
Freshservice
Configure
Templates
Google Maps
Configure
Templates
Here
Configure
Templates
HubSpot
Configure
Templates
JIRA
Configure
Templates
Microsoft Graph
Configure
Templates
Open AI
Configure
Templates
Salesforce
Configure
Templates
ServiceNow
Configure
Templates
Stripe
Configure
Templates
Shopify
Configure
Templates
Twilio
Configure
Templates
Zendesk
Configure
Templates
Agents
Agent Transfer Overview
Custom (BotKit)
Drift
Genesys
Intercom
NiceInContact
NiceInContact(User Hub)
Salesforce
ServiceNow
Configure Tokyo and Lower versions
Configure Utah and Higher versions
Unblu
External NLU Adapters
Overview
Dialogflow Engine
Test and Debug
Deploy
Channels
Publishing
Versioning
Analyze
Introduction
Dashboard Filters
Overview Dashboard
Conversations Dashboard
Users Dashboard
Performance Dashboard
Custom Dashboards
Introduction
Custom Meta Tags
Create Custom Dashboard
Create Custom Dashboard Filters
LLM and Generative AI Logs
NLP Insights
Task Execution Logs
Conversations History
Conversation Flows
Conversation Insights
Feedback Analytics
Usage Metrics
Containment Metrics
Universal Bots
Introduction
Universal Bot Definition
Universal Bot Creation
Training a Universal Bot
Universal Bot Customizations
Enabling Languages
Store
Manage Assistant
Team Collaboration
Plan & Usage
Overview
Usage Plans
Templates
Support Plans
Invoices
Authorization
Conversation Sessions
Multilingual Virtual Assistants
Get Started
Supported Components & Features
Manage Languages
Manage Translation Services
Multiingual Virtual Assistant Behavior
Feedback Survey
Masking PII Details
Variables
Collections
IVR Settings
General Settings
Assistant Management
Manage Namespace
Data
Overview
Data Table
Table Views
App Definitions
Data as Service
HOW TOs
Build a Travel Planning Assistant
Travel Assistant Overview
Create a Travel Virtual Assistant
Design Conversation Skills
Create an ‘Update Booking’ Task
Create a Change Flight Task
Build a Knowledge Graph
Schedule a Smart Alert
Design Digital Skills
Configure Digital Forms
Configure Digital Views
Train the Assistant
Use Traits
Use Patterns
Manage Context Switching
Deploy the Assistant
Use Bot Functions
Use Content Variables
Use Global Variables
Use Web SDK
Build a Banking Assistant
Design Conversation Skills
Create a Sample Banking Assistant
Create a Transfer Funds Task
Create a Update Balance Task
Create a Knowledge Graph
Set Up a Smart Alert
Design Digital Skills
Configure Digital Forms
Configure Digital Views
Add Data to Data Tables
Update Data in Data Tables
Add Data from Digital Forms
Train the Assistant
Composite Entities
Use Traits
Use Patterns for Intents & Entities
Manage Context Switching
Deploy the Assistant
Configure an Agent Transfer
Use Assistant Functions
Use Content Variables
Use Global Variables
Intent Scoping using Group Node
Analyze the Assistant
Create a Custom Dashboard
Use Custom Meta Tags in Filters
Migrate External Bots
Google Dialogflow Bot
APIs & SDKs
API Reference
API Introduction
Rate Limits
API List
koreUtil Libraries
SDK Reference
SDK Introduction
Web SDK
How the Web SDK Works
SDK Security
SDK Registration
Web Socket Connect and RTM
Tutorials
Widget SDK Tutorial
Web SDK Tutorial
BotKit SDK
BotKit SDK Deployment Guide
Installing the BotKit SDK
Using the BotKit SDK
SDK Events
SDK Functions
Tutorials
BotKit - Blue Prism
BotKit - Flight Search Sample VA
BotKit - Agent Transfer
  1. Home
  2. Docs
  3. Virtual Assistants
  4. How Tos
  5. Using Patterns for Intents & Entities

Using Patterns for Intents & Entities

Using patterns can help to improve NLP interpreter accuracy.

In this document, we will elaborate on the various pattern syntax and how they can be used in intent detection and entity extraction.

Things to Remember:

  • Patterns are to be used as a last resort, only for cases where ML engine cannot be used. Examples of such cases would be to train bot in recognising idiomatic utterances, command like utterances.
  • Patterns are evaluated in the order of their listing. Once a match is found the rest of the patterns are not evaluated. So ensure when adding patterns to add in the order of most restrictive to least restrictive.
  • Only one wildcard (*) is allowed in a pattern.
  • While most of the features are supported in all languages, there are some exceptions, see here for more details.
The following are some general guideline for creating intent patterns:
  • Use a minimum of 3 words.
  • Use words in their canonical forms (i.e. infinitive verbs, singular nouns).
  • Use lowercase both for words and their synonyms.
  • Use the US spelling of words (i.e. normalize instead of normalise).
  • Avoid using determiners and pronouns (the, a, my, that).
  • Avoid using digits.
  • Avoid using entity values in defining a task pattern.
  • Don’t use elision (i.e. what’s ).
  • Don’t use special characters such as () & / \ $ [ ] + *.
  • Don’t use punctuation such as – , . ! ? ‘ “.

Patterns for Intent Detection

Following is a list of pattern syntax, along with examples, that can be configured for intent detection.

Note: Pattern matching occurs in the canonical form of a sentence. Therefore, the words in a pattern should be in their canonical form.

 

Pattern Description Pattern Examples
word1
word2 …
wordn
This mandates all the words defined to be available in the user utterance in the same consecutive order with upto 3 (language specific) additional words allowed between any two consecutive words mentioned in the pattern and infinite number of words before and after those specified set of words.

Note: The three wildcard words are configurable as advanced NLP options.

Sample Pattern credit card limit
Utterance Match
– “can you please let me know my credit card limit?
– “What is the credit card limit for Priority customers?
– “I would like to know how to enhance my credit card with a new limit.
Utterance not Matching – “I want to know what the credit limit on my Priority Privilege Card is.
– “Can I enhance the credit limit after one year on my card?
– “Will the credit card I’m using be eligible for a limit increase next month?
word1_word2 Compound words:  A compound word is treated as one word and that impacts how the canonical form is constructed. No additional words allowed in between word1 and word2. This is to ensure that a sequence of tokens are read as a phrase. Usage is restricted to words, concepts not allowed.

Note: There should be no space between the word1, word2 and _.

Sample Pattern credit_card
Utterance Match can you help me with my credit card balance?
Utterance not Matching can you please let me know when I would receive the credit on my card?
_word1 _word1 ensures that the word1 in the user utterance is not marked as Used Up by the platform and is to be considered for entity extraction. This is useful when entity words are used in the intent pattern.

For e.g., the pattern (buy ~number ticket) will match “buy 2 tickets for the show at 7”; each of the three pattern words internally will be tracked as used up, but a ticket number entity will first consider “7” and not “2” because “7” is not used up. If the pattern is changed to (buy _~number ticket), then “2” is still matched for the intent pattern but the word is not marked as used up and the entity would consider it, hence the leading underscore is useful for pattern tokens that constitute important data.

Sample Pattern “buy _~number tickets
Utterance Match Can you help me to buy 2 tickets for the show at 7 P.M.?
Utterance not Matching NA
word1 *n word2 Exactly n number of additional words between the specified words/phrases
Sample Pattern credit *3 card
Utterance Match – “can you tell me what the credit limit on my card will be if I upgrade to Platinum?
Utterance not Matching – “can you tell me what the credit limit on my new card will be if I upgrade to Platinum?
– “can you please tell me how many points I can earn for each transaction on my Credit Card?
– “can my credit card’s limit be enhanced further?
word1 *~n word2 Up to n number of additional words between the specified words/phrases.

Note: FM engine automatically generates variations with this wildcard and unless it is a special scenario, developers do not further perform any action.
An advanced NLP configuration setting allows developers to change the default number of possible wildcards between tokens.
Sample Pattern credit *~3 card
Utterance Match – “can you tell me what the credit limit on my card will be if I upgrade to Platinum?

_“can you tell me what the credit on my card is?”
Utterance not Matching – “can you tell me what the credit limit on my new card will be if I upgrade to Platinum?
word1 *0 word2 To disable wildcards between two tokens. Similar to the underscore between two words but can be used between two concepts or within [  ], {  } groups.
(available 7.1 onwards).
Note: If a phrase needs to be treated as an idiom or  a complete unit, then instead of using an _ or the *0 syntax, the phrase can be used in concept. The advantages of this usage are having a specific sequence of words, correct canonical handling, easy reuse, and better performance.
Sample Pattern credit *0 card
Utterance Match – “can you please check on my credit card usage last week?

– “can you help me with this merchant transaction ID on my credit card?

Utterance not Matching I want to enhance the credit limit on this card next month.
 < word1 word2 Indicates the match for word1 should start from the beginning of a sentence. Add a space after the angular bracket.

Note: <’ indicates the start of the sentence. The next token would match the first word.

Sample Pattern < cancel card”
Utterance Match – “cancel my credit card.
– “please cancel my credit card.
Utterance not Matching I want to check my credit balance before knowing how to cancel the card
word1 word2 > Indicates that the next word or phrase after detecting the exact match is the end of the sentence.

Add a space before closing the angular bracket

Sample Pattern credit card >
Utterance Match – “I can’t see the balance on my credit card.
– “What are the standing instructions on my credit card?
Utterance not Matching The credit limit on the card is not showing.
!abc Indicates the word/concept “abc” should not exist anywhere in the user utterance after this token

No space between ! and word/concept

Sample Pattern – “!block my credit card”
Utterance Match I want to know the balance on my credit card.
Utterance not Matching – “How to block my credit card? 
!!abc The very next word/concept should not be “abc”
No space between !! and word/concept.
Sample Pattern credit card !!balance
Utterance Match – “I want to check my credit card limit.
– “What is the limit on my credit card?”
– “I want to check if there is any amount due on my corporate credit card.
Utterance not Matching What is my credit card balance?
[ … ] Used to define a group of words/concepts and the match should be against exactly one of the group declared in [ ]. Be aware that when a match is found the rest of the group is ignored, so order the words accordingly.

Note: The brackets should not be clubbed with the word, i.e. maintain a space between the parenthesis and the adjacent word.
Sample Pattern credit card [ limit balance expire ]
Utterance Match – “When will my credit card limit be increased?
– “What is my credit card balance as on date?
– “When will my credit card expire?”
Utterance not Matching What is the process for credit card replacement?
{ … } Used to define an optional group or words/concepts and the match would be against zero or one of the words/patterns declared in { }. Be aware that when a match is found, rest of the group is ignored, so order the words accordingly.

Note: The brackets should not be clubbed with the word, i.e. maintain a space between the parenthesis and the adjacent word.
Sample Pattern “what balance { husband wife } credit card
Utterance Match – “What is the balance on my husband’s credit card?
–  “What balance does my credit card show?
Utterance not Matching – “What is the name on my credit card?”
( … ) Contains a sub-pattern i.e. when a pattern or part of a pattern is enclosed in these parentheses, we treat it as a pattern unlike [ ] and { }.
This is the default setting i.e. when a pattern word1 word2 it is treated as ( word1 word2 )
Commonly used explicitly to define sub pattern inside [ ] or { }
Sample Pattern ( credit card )
Utterance Match I don’t have my credit card with me right now.
Utterance not Matching If I am upgraded to a Gold membership, will the credit limit on the new card be increased?”
<< … >> Used to find words in any order anywhere in the sentence.

Due to the risk of running into false positives, you are advised not to use this pattern.

Sample Pattern << credit limit on the card >>
Utterance Match – “can the credit limit on the card be enhanced?
“On Tuesday I got a new card with a raised limit, so I would like to apply some in-store credit to it.
Utterance not Matching Please confirm my outstanding amount.
‘word1 If you quote words or use words that are not in canonical form, the system will restrict itself to what you used in the pattern.
Sample Pattern “cancel ‘the transaction”
Utterance Match I want to cancel the transaction.
Utterance not Matching I would like to cancel a transaction.”
word1~concept2
~concept1~concept2
(from ver8.0)
A word (word1) or concept (concept1) can be matched only if it is also a member of another concept (concept2). The most common usage of this is through the system concepts that are dynamically added for each POS tag.
Sample Pattern credit~verb
Utterance Match Can you credit this amount to my source account please?
Utterance not Matching This is a credit and not a debit transaction.
word1 * word2 0 to infinite number of additional words between the specified words/phrases.
Sample Pattern credit * card
Utterance Match – “can you please confirm if the credit limit on my priority card can be enhanced this month?

– “can you help me understand if the credit limit will get affected if I do not use my card for more than six months?

Utterance not Matching “I want to understand your credit limit enhancement policy.

Pattern Operators

  • AND: ( X Y ): An ordered relationship of words in sequence. This is the default setting. i.e. when you specify a pattern as cancel order it is the same as (cancel order).
    For example, (Cancel Order) matches Cancel my phone order but doesn’t match I have a pending order for an iPhone X, can I cancel. Bot Builder tool uses patterns with increasing numbers of wildcards between words (up to 3 for an intent). So a pattern of Cancel Order can match:

    • cancel order
    • cancel my order
    • cancel that last order
    • cancel last weeks big order
  • OR: [X Y Z]: Any of these can be interchangeably used in the user utterance. For example, ([get make] me [food drink dessert]) will match any of the below utterances:
    • Get me food
    • Make me a drink
    • Get me a drink
    • Get me a dessert
    • Make me some quick food
  • NOT: !X: Words that should not appear in the user utterance for an intent match. For example, (!forecast) is marked as a pattern for intent named Get current weather and the bot supports another intent called Get 3-day weather forecast.
    • User utterance: Planning a trip to California get me the forecast
      • will not match Get current weather
      • will match Get 3-day weather forecast
        Note that the !word means not after this point. So (!forecast the weather) and (get the weather !forecast) are different. The utterance get the forecast for the weather matches the second but not the first.
  • Optional: {X}: For example, {phone} If the user utterance is Get me a phone number or get me a number the platform will treat it equally.
  • Enforce Phrase: X_Y: To enforce occurrence of the phrase as is in the user utterance, without any words in between. For example, transfer_funds. The utterance transfer funds or I want to transfer funds will match but not Can I transfer some funds.
  • Concepts: ~: Platform has a large set of inbuilt concepts that developers can use to define a pattern. For example, (I [like love] ~world_country) will match
    • I like India
    • I love traveling to Australia
    • I would like to visit an African country
  • Unordered: <<, >>: Used to find words in any order. For example, <<Cancel Order>> matches Cancel my phone order and also I have a pending order for an iPhone X, can I cancel
  • Start/End of Statement: <, >: For example, ( transfer fund > ) will match I want to transfer funds but will not match transfer funds today.
  • Quote: ‘ –: If you quote words or use words that are not in canonical form, the system will restrict itself to what you used in the pattern. For example, (like to transfer funds) This matches I would like to transfer funds from my account but not I really liked transfer funds process.

Negative Patterns

Negative Patterns can be used to eliminate intents detected in the presence of a phrase. This will help filter the matched intents for false positives.

User Utterance: “I was transferring funds when I got network failure error”
Intent DetectedTransfer Funds
Intended IntentRegister Complaint

Add a Negative Pattern (network failure) (error) (technical issue) for the intent Transfer Funds
User Utterance: “I was transferring funds when I got network failure error”
or “I was transferring funds when I faced a technical issue”
or “I got an error during transfer funds process.”
Intent RejectedTransfer Funds
Intent Triggered: Register Complaint

Note: The negative pattern is not supported for FAQs in any language.

Patterns for Entity Extraction

Patterns can be used to identify the values for entities in user utterance based upon their position and occurrence in user utterance.

Intent patterns operators like {…}, […], !, ~concepts can be used for entity extraction. The following are some use cases how the patterns can be applied.

Every entity pattern has to include a * (of some form) to represent where the platform should look for an entity value.

Continuing with the Banking Bot example with Transfer Funds intent. This intent needs two entities – ToAccount and FromAccount. We will see how to achieve this.

Pattern 1: word1 * word2

This can be used as a positional wildcard that indicates the expected position of the entity.
Pattern for ToAccount entityto * from
User UtteranceTransfer funds to ABC123 from my account.
Entity ExtractedToAccount = ABC123
User Utterance not resulting in entity extraction: “transfer funds for ABC123 from my account”

Pattern 2: word1 *n

This can be used as a positional wildcard * that indicates the expected position of the entity based upon the number of words after the specified word1. That is, n words after the word1 are to be considered for the entity, if n words are not present then look for the next occurence of word1.
Pattern for ToAccount entity: from *2
User UtteranceTransfer funds to ABC123 from my account.
Entity Extracted: FromAccount = my account
User Utterance: Transfer funds to ABC123 from XYZ321 that is from my account.
Entity Extracted
: FromAccount = my account
User Utterance not resulting in entity extraction
: “transfer funds to  ABC123 using my account”

Extension to Pattern 2: word1 *~n

Similar to above (pattern 2) but extracts up to n number, if that number of words are available. Note that entities need to extract something so *~1 is really the same as *1.

Pattern 3: a combination of word1 * word2 and word3 *n

This can be used as a combination of patterns for the likely location in the user utterance that the entity value could be found and the number of words contributing to the entity.
Pattern for ToAccount entity“to * from” and “from to *1”
Pattern for FromAccount entity: “from * to” and “to from *2”
User UtteranceTransfer funds to ABC123 from my account.
                       or Transfer funds from my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds for ABC123 using my account”

Pattern 4: [ word1 word2 ] *

This can be for patterns using a group of words or concepts of which at least one should be present in the utterance. The order within the group is important (see above in intent detection for details).
Pattern for ToAccount entity“to * [ using from ]” and “[ using from ] to *1”
Pattern for FromAccount entity: “[ using from ] * to” and “to [ using from ] *”
User UtteranceTransfer funds to ABC123 from my account.
                       or Transfer funds using my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds for ABC123 using my account”

Pattern 5: ~CustomConcept *

This can be for using concepts. You can create your own custom concepts and use them to define patterns.
Pattern for ToAccount entity“to * from” and “from to *”
Pattern for FromAccount entity: “~in * to” and “to ~in *”
Custom Concept: ~in(using) (from)
User UtteranceTransfer funds to ABC123 using my account.
                       or Transfer funds from my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds to ABC123 of my account

Pattern 6: ~intent

Useful in entity patterns and custom entities
Words that are used in the intent identification are dynamically marked with the ~intent concept. This can then be used as an anchor or reference point for some entity patterns.
Sample Pattern“~intent~meeting~plural
User Utterance not resulting in entity extraction: show my meetings.
User Utterance might mark the entity: “schedule a presentation called Meeting the Sales Goals

Pattern 7: $currentEntity

Useful in delaying the evaluation of a pattern until the entity is actually processed. Normally entity patterns are evaluated when a dialog starts and on new input to see if any words need to be protected until that entity is processed. This might not always desirable, especially for strings.
Pattern“$currentEntity=TaskTitle ‘called *
The above rule will result in evaluating the pattern when the dialog flow has reached the TaskTitle node.

Using Patterns for Intents & Entities

Using patterns can help to improve NLP interpreter accuracy.

In this document, we will elaborate on the various pattern syntax and how they can be used in intent detection and entity extraction.

Things to Remember:

  • Patterns are to be used as a last resort, only for cases where ML engine cannot be used. Examples of such cases would be to train bot in recognising idiomatic utterances, command like utterances.
  • Patterns are evaluated in the order of their listing. Once a match is found the rest of the patterns are not evaluated. So ensure when adding patterns to add in the order of most restrictive to least restrictive.
  • Only one wildcard (*) is allowed in a pattern.
  • While most of the features are supported in all languages, there are some exceptions, see here for more details.
The following are some general guideline for creating intent patterns:
  • Use a minimum of 3 words.
  • Use words in their canonical forms (i.e. infinitive verbs, singular nouns).
  • Use lowercase both for words and their synonyms.
  • Use the US spelling of words (i.e. normalize instead of normalise).
  • Avoid using determiners and pronouns (the, a, my, that).
  • Avoid using digits.
  • Avoid using entity values in defining a task pattern.
  • Don’t use elision (i.e. what’s ).
  • Don’t use special characters such as () & / \ $ [ ] + *.
  • Don’t use punctuation such as – , . ! ? ‘ “.

Patterns for Intent Detection

Following is a list of pattern syntax, along with examples, that can be configured for intent detection.

Note: Pattern matching occurs in the canonical form of a sentence. Therefore, the words in a pattern should be in their canonical form.

 

Pattern Description Pattern Examples
word1
word2 …
wordn
This mandates all the words defined to be available in the user utterance in the same consecutive order with upto 3 (language specific) additional words allowed between any two consecutive words mentioned in the pattern and infinite number of words before and after those specified set of words.

Note: The three wildcard words are configurable as advanced NLP options.

Sample Pattern credit card limit
Utterance Match
– “can you please let me know my credit card limit?
– “What is the credit card limit for Priority customers?
– “I would like to know how to enhance my credit card with a new limit.
Utterance not Matching – “I want to know what the credit limit on my Priority Privilege Card is.
– “Can I enhance the credit limit after one year on my card?
– “Will the credit card I’m using be eligible for a limit increase next month?
word1_word2 Compound words:  A compound word is treated as one word and that impacts how the canonical form is constructed. No additional words allowed in between word1 and word2. This is to ensure that a sequence of tokens are read as a phrase. Usage is restricted to words, concepts not allowed.

Note: There should be no space between the word1, word2 and _.

Sample Pattern credit_card
Utterance Match can you help me with my credit card balance?
Utterance not Matching can you please let me know when I would receive the credit on my card?
_word1 _word1 ensures that the word1 in the user utterance is not marked as Used Up by the platform and is to be considered for entity extraction. This is useful when entity words are used in the intent pattern.

For e.g., the pattern (buy ~number ticket) will match “buy 2 tickets for the show at 7”; each of the three pattern words internally will be tracked as used up, but a ticket number entity will first consider “7” and not “2” because “7” is not used up. If the pattern is changed to (buy _~number ticket), then “2” is still matched for the intent pattern but the word is not marked as used up and the entity would consider it, hence the leading underscore is useful for pattern tokens that constitute important data.

Sample Pattern “buy _~number tickets
Utterance Match Can you help me to buy 2 tickets for the show at 7 P.M.?
Utterance not Matching NA
word1 *n word2 Exactly n number of additional words between the specified words/phrases
Sample Pattern credit *3 card
Utterance Match – “can you tell me what the credit limit on my card will be if I upgrade to Platinum?
Utterance not Matching – “can you tell me what the credit limit on my new card will be if I upgrade to Platinum?
– “can you please tell me how many points I can earn for each transaction on my Credit Card?
– “can my credit card’s limit be enhanced further?
word1 *~n word2 Up to n number of additional words between the specified words/phrases.

Note: FM engine automatically generates variations with this wildcard and unless it is a special scenario, developers do not further perform any action.
An advanced NLP configuration setting allows developers to change the default number of possible wildcards between tokens.
Sample Pattern credit *~3 card
Utterance Match – “can you tell me what the credit limit on my card will be if I upgrade to Platinum?

_“can you tell me what the credit on my card is?”
Utterance not Matching – “can you tell me what the credit limit on my new card will be if I upgrade to Platinum?
word1 *0 word2 To disable wildcards between two tokens. Similar to the underscore between two words but can be used between two concepts or within [  ], {  } groups.
(available 7.1 onwards).
Note: If a phrase needs to be treated as an idiom or  a complete unit, then instead of using an _ or the *0 syntax, the phrase can be used in concept. The advantages of this usage are having a specific sequence of words, correct canonical handling, easy reuse, and better performance.
Sample Pattern credit *0 card
Utterance Match – “can you please check on my credit card usage last week?

– “can you help me with this merchant transaction ID on my credit card?

Utterance not Matching I want to enhance the credit limit on this card next month.
 < word1 word2 Indicates the match for word1 should start from the beginning of a sentence. Add a space after the angular bracket.

Note: <’ indicates the start of the sentence. The next token would match the first word.

Sample Pattern < cancel card”
Utterance Match – “cancel my credit card.
– “please cancel my credit card.
Utterance not Matching I want to check my credit balance before knowing how to cancel the card
word1 word2 > Indicates that the next word or phrase after detecting the exact match is the end of the sentence.

Add a space before closing the angular bracket

Sample Pattern credit card >
Utterance Match – “I can’t see the balance on my credit card.
– “What are the standing instructions on my credit card?
Utterance not Matching The credit limit on the card is not showing.
!abc Indicates the word/concept “abc” should not exist anywhere in the user utterance after this token

No space between ! and word/concept

Sample Pattern – “!block my credit card”
Utterance Match I want to know the balance on my credit card.
Utterance not Matching – “How to block my credit card? 
!!abc The very next word/concept should not be “abc”
No space between !! and word/concept.
Sample Pattern credit card !!balance
Utterance Match – “I want to check my credit card limit.
– “What is the limit on my credit card?”
– “I want to check if there is any amount due on my corporate credit card.
Utterance not Matching What is my credit card balance?
[ … ] Used to define a group of words/concepts and the match should be against exactly one of the group declared in [ ]. Be aware that when a match is found the rest of the group is ignored, so order the words accordingly.

Note: The brackets should not be clubbed with the word, i.e. maintain a space between the parenthesis and the adjacent word.
Sample Pattern credit card [ limit balance expire ]
Utterance Match – “When will my credit card limit be increased?
– “What is my credit card balance as on date?
– “When will my credit card expire?”
Utterance not Matching What is the process for credit card replacement?
{ … } Used to define an optional group or words/concepts and the match would be against zero or one of the words/patterns declared in { }. Be aware that when a match is found, rest of the group is ignored, so order the words accordingly.

Note: The brackets should not be clubbed with the word, i.e. maintain a space between the parenthesis and the adjacent word.
Sample Pattern “what balance { husband wife } credit card
Utterance Match – “What is the balance on my husband’s credit card?
–  “What balance does my credit card show?
Utterance not Matching – “What is the name on my credit card?”
( … ) Contains a sub-pattern i.e. when a pattern or part of a pattern is enclosed in these parentheses, we treat it as a pattern unlike [ ] and { }.
This is the default setting i.e. when a pattern word1 word2 it is treated as ( word1 word2 )
Commonly used explicitly to define sub pattern inside [ ] or { }
Sample Pattern ( credit card )
Utterance Match I don’t have my credit card with me right now.
Utterance not Matching If I am upgraded to a Gold membership, will the credit limit on the new card be increased?”
<< … >> Used to find words in any order anywhere in the sentence.

Due to the risk of running into false positives, you are advised not to use this pattern.

Sample Pattern << credit limit on the card >>
Utterance Match – “can the credit limit on the card be enhanced?
“On Tuesday I got a new card with a raised limit, so I would like to apply some in-store credit to it.
Utterance not Matching Please confirm my outstanding amount.
‘word1 If you quote words or use words that are not in canonical form, the system will restrict itself to what you used in the pattern.
Sample Pattern “cancel ‘the transaction”
Utterance Match I want to cancel the transaction.
Utterance not Matching I would like to cancel a transaction.”
word1~concept2
~concept1~concept2
(from ver8.0)
A word (word1) or concept (concept1) can be matched only if it is also a member of another concept (concept2). The most common usage of this is through the system concepts that are dynamically added for each POS tag.
Sample Pattern credit~verb
Utterance Match Can you credit this amount to my source account please?
Utterance not Matching This is a credit and not a debit transaction.
word1 * word2 0 to infinite number of additional words between the specified words/phrases.
Sample Pattern credit * card
Utterance Match – “can you please confirm if the credit limit on my priority card can be enhanced this month?

– “can you help me understand if the credit limit will get affected if I do not use my card for more than six months?

Utterance not Matching “I want to understand your credit limit enhancement policy.

Pattern Operators

  • AND: ( X Y ): An ordered relationship of words in sequence. This is the default setting. i.e. when you specify a pattern as cancel order it is the same as (cancel order).
    For example, (Cancel Order) matches Cancel my phone order but doesn’t match I have a pending order for an iPhone X, can I cancel. Bot Builder tool uses patterns with increasing numbers of wildcards between words (up to 3 for an intent). So a pattern of Cancel Order can match:

    • cancel order
    • cancel my order
    • cancel that last order
    • cancel last weeks big order
  • OR: [X Y Z]: Any of these can be interchangeably used in the user utterance. For example, ([get make] me [food drink dessert]) will match any of the below utterances:
    • Get me food
    • Make me a drink
    • Get me a drink
    • Get me a dessert
    • Make me some quick food
  • NOT: !X: Words that should not appear in the user utterance for an intent match. For example, (!forecast) is marked as a pattern for intent named Get current weather and the bot supports another intent called Get 3-day weather forecast.
    • User utterance: Planning a trip to California get me the forecast
      • will not match Get current weather
      • will match Get 3-day weather forecast
        Note that the !word means not after this point. So (!forecast the weather) and (get the weather !forecast) are different. The utterance get the forecast for the weather matches the second but not the first.
  • Optional: {X}: For example, {phone} If the user utterance is Get me a phone number or get me a number the platform will treat it equally.
  • Enforce Phrase: X_Y: To enforce occurrence of the phrase as is in the user utterance, without any words in between. For example, transfer_funds. The utterance transfer funds or I want to transfer funds will match but not Can I transfer some funds.
  • Concepts: ~: Platform has a large set of inbuilt concepts that developers can use to define a pattern. For example, (I [like love] ~world_country) will match
    • I like India
    • I love traveling to Australia
    • I would like to visit an African country
  • Unordered: <<, >>: Used to find words in any order. For example, <<Cancel Order>> matches Cancel my phone order and also I have a pending order for an iPhone X, can I cancel
  • Start/End of Statement: <, >: For example, ( transfer fund > ) will match I want to transfer funds but will not match transfer funds today.
  • Quote: ‘ –: If you quote words or use words that are not in canonical form, the system will restrict itself to what you used in the pattern. For example, (like to transfer funds) This matches I would like to transfer funds from my account but not I really liked transfer funds process.

Negative Patterns

Negative Patterns can be used to eliminate intents detected in the presence of a phrase. This will help filter the matched intents for false positives.

User Utterance: “I was transferring funds when I got network failure error”
Intent DetectedTransfer Funds
Intended IntentRegister Complaint

Add a Negative Pattern (network failure) (error) (technical issue) for the intent Transfer Funds
User Utterance: “I was transferring funds when I got network failure error”
or “I was transferring funds when I faced a technical issue”
or “I got an error during transfer funds process.”
Intent RejectedTransfer Funds
Intent Triggered: Register Complaint

Note: The negative pattern is not supported for FAQs in any language.

Patterns for Entity Extraction

Patterns can be used to identify the values for entities in user utterance based upon their position and occurrence in user utterance.

Intent patterns operators like {…}, […], !, ~concepts can be used for entity extraction. The following are some use cases how the patterns can be applied.

Every entity pattern has to include a * (of some form) to represent where the platform should look for an entity value.

Continuing with the Banking Bot example with Transfer Funds intent. This intent needs two entities – ToAccount and FromAccount. We will see how to achieve this.

Pattern 1: word1 * word2

This can be used as a positional wildcard that indicates the expected position of the entity.
Pattern for ToAccount entityto * from
User UtteranceTransfer funds to ABC123 from my account.
Entity ExtractedToAccount = ABC123
User Utterance not resulting in entity extraction: “transfer funds for ABC123 from my account”

Pattern 2: word1 *n

This can be used as a positional wildcard * that indicates the expected position of the entity based upon the number of words after the specified word1. That is, n words after the word1 are to be considered for the entity, if n words are not present then look for the next occurence of word1.
Pattern for ToAccount entity: from *2
User UtteranceTransfer funds to ABC123 from my account.
Entity Extracted: FromAccount = my account
User Utterance: Transfer funds to ABC123 from XYZ321 that is from my account.
Entity Extracted
: FromAccount = my account
User Utterance not resulting in entity extraction
: “transfer funds to  ABC123 using my account”

Extension to Pattern 2: word1 *~n

Similar to above (pattern 2) but extracts up to n number, if that number of words are available. Note that entities need to extract something so *~1 is really the same as *1.

Pattern 3: a combination of word1 * word2 and word3 *n

This can be used as a combination of patterns for the likely location in the user utterance that the entity value could be found and the number of words contributing to the entity.
Pattern for ToAccount entity“to * from” and “from to *1”
Pattern for FromAccount entity: “from * to” and “to from *2”
User UtteranceTransfer funds to ABC123 from my account.
                       or Transfer funds from my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds for ABC123 using my account”

Pattern 4: [ word1 word2 ] *

This can be for patterns using a group of words or concepts of which at least one should be present in the utterance. The order within the group is important (see above in intent detection for details).
Pattern for ToAccount entity“to * [ using from ]” and “[ using from ] to *1”
Pattern for FromAccount entity: “[ using from ] * to” and “to [ using from ] *”
User UtteranceTransfer funds to ABC123 from my account.
                       or Transfer funds using my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds for ABC123 using my account”

Pattern 5: ~CustomConcept *

This can be for using concepts. You can create your own custom concepts and use them to define patterns.
Pattern for ToAccount entity“to * from” and “from to *”
Pattern for FromAccount entity: “~in * to” and “to ~in *”
Custom Concept: ~in(using) (from)
User UtteranceTransfer funds to ABC123 using my account.
                       or Transfer funds from my account to ABC123.
Entity ExtractedToAccount = ABC123 and FromAccount = my account
User Utterance not resulting in entity extraction: “transfer funds to ABC123 of my account

Pattern 6: ~intent

Useful in entity patterns and custom entities
Words that are used in the intent identification are dynamically marked with the ~intent concept. This can then be used as an anchor or reference point for some entity patterns.
Sample Pattern“~intent~meeting~plural
User Utterance not resulting in entity extraction: show my meetings.
User Utterance might mark the entity: “schedule a presentation called Meeting the Sales Goals

Pattern 7: $currentEntity

Useful in delaying the evaluation of a pattern until the entity is actually processed. Normally entity patterns are evaluated when a dialog starts and on new input to see if any words need to be protected until that entity is processed. This might not always desirable, especially for strings.
Pattern“$currentEntity=TaskTitle ‘called *
The above rule will result in evaluating the pattern when the dialog flow has reached the TaskTitle node.

Menu