Chatbot Overview
Conversational Bots
Intents & Entities
Intelligent Bots
Kore.ai's Approach
Kore.ai Conversational Platform
Bot Concepts and Terminology
Natural Language Processing (NLP)
Bot Types
Bot Tasks
Starting with Kore.ai Platform
How to Access Bot Builder
Working with Kore.ai Bot Builder
Building your first Bot
Getting Started with Building Bots
Using the Dialog Builder Tool
Creating a Simple Bot
Release Notes
Latest Updates
Older Releases
Bot Builder
Creating a Bot
Design
Develop
Dialog Task
Working with User Intent Node
Working with the Dialog Node
Working with Entity Node
Supported Entity Types
Working with Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Working with Message Nodes
Working with the Confirmation Nodes
Working with Service Node
Implementing Custom Authentication
Enabling 2-way SSL for Service nodes
Working with Script Node
Working with Agent Transfer Node
Working with WebHook Node
Defining Connections & Transitions
Managing Dialogs
Prompt Editor
Action & Information Task
Working with Action Tasks
Working with Information Tasks
Establishing Flows
Alert Tasks
Working with Alert Tasks
Managing Ignore Words and Field Memory
Knowledge Graph
Terminology
Building Knowledge Graph
Generation of Knowledge Graph
Importing and Exporting Knowledge Graph
Knowledge Graph Analysis
Knowledge Extraction
Natural Language
Overview
Machine Learning
ML Model
Fundamental Meaning
Knowledge Graph Training
Traits
Ranking and Resolver
NLP Detection
NLP Settings and Guidelines
Bot Intelligence
Overview
Context Management
Session and Context Variables
Context Object
Dialog Management
Sub-Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Default Conversations
Default Standard Responses
Channel Enablement
Test & Debug
Talking to Bot
Utterance Testing
Batch Testing
Recording Conversations
Publishing your Bot
Analyzing your Bot
Overview
Dashboard
Custom Dashboard
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
Universal Bots
Defining
Creating
Customizing
Enabling Languages
Smart Bots
Defining
Sample Bots
Github
Asana
Travel Planning
Flight Search
Event Based Bot Actions
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Bot Management
Using Bot Variables
API Guide
API Overview
API List
API Collection
SDKs
SDK Overview
SDK Security
SDK App Registration
Kore.ai Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Web Socket Connect & RTM
Using the BotKit SDK
Installing the BotKit SDK
BotKit SDK Configuration
Events for the BotKit SDK
Functions for the BotKit SDK
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Enrollment
Inviting Users
Sending Bulk Invites to Enroll Users
Importing Users and User Data
Synchronizing Users from Active Directory
Security & Compliance
Overview
Using Single Sign-On
Cloud Connector
Analytics
Billing
Bot Store
Overview
Creating a Kore.ai Bot Account
Adding a Kore.ai Bot
Choosing a Channel for a Bot
Interacting with a Kore.ai Bot
Setting Up Web Service Alerts
Setting Up RSS Alerts
Setting Up the Kore.ai Webhook Bot
Custom Kore.ai Bots
Bots for your Customers FAQs
Bots for your Workforce FAQs
Adding Bots
Contacting Kore.ai Support
Setting Up Filters
Bot Store Settings
How Tos
Context Switching
Using Traits
Live Agent Transfer
Schedule a Smart Alert
Configure Agent Transfer
Custom Dashboard
Patterns for Intents & Entities
Build Knowledge Graph
  1. Home
  2. Docs
  3. Bots
  4. How Tos
  5. How to use Patterns for Intents & Entities

How to use 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 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.

Patterns for Intent Detection

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

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.
Sample Pattern transfer fund
Utterance Match – “can you please transfer funds from my account
– “can you please transfer some funds from my account
– “transfer funds
Utterance not Matching – “i want to transfer
– “can i transfer some significant amount of monetary funds
– “i want to do fund transfer
word1_word2 Enforce phrase, no additional words allowed in between word1 and word2. This is to ensure a sequence of tokens are read as a phrase. Usage restricted to words, concepts not allowed.
Note: There should be no space between the word1, word2 and _. Also be aware that “_word1” is to ensure 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.
Sample Pattern transfer_fund
Utterance Match can you help me transfer funds
Utterance not Matching can you please transfer some funds from my account
word1 * word2 0 to infinite number of additional words between the specified words/phrases
Sample Pattern transfer * fund
Utterance Match – “can you please transfer some funds from my account
– “can you help me transfer funds
Utterance not Matching i want to transfer
word1 *n word2 Exactly n number of additional words between the specified words/phrases
Sample Pattern transfer *2 fund
Utterance Match – “can you help me transfer some significant funds from my account
Utterance not Matching – “i want to transfer
– “can you please transfer some funds from my account
– “can you help me transfer some significant amount of funds
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)
Sample Pattern transfer *0 fund
Utterance Match – “can you please transfer funds from my account
– “can you help me transfer funds
Utterance not Matching i want to transfer some funds
word1 < word2 Indicates the match for word2 should start from the beginning of a sentence. It is useful especially when the word2 appears in the middle of the utterance.
Add a space after the angular bracket
Sample Pattern transfer < fund
Utterance Match – “want to transfer funds
– “i want to initiate fund transfer
Utterance not Matching i want to transfer
word1 > word2 Indicates the end of the sentence and no words are allowed after it.
Add a space before closing the angular bracket
Sample Pattern transfer * fund >
Utterance Match – “transfer funds
– “transfer few funds
Utterance not Matching transfer funds today
!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 – “!status transfer fund
– “transfer !status fund
– “transfer fund !status
Utterance Match i want to transfer funds
Utterance not Matching – “what is the status of my fund transfer
– “i want to find my fund transfer status
!!abc The very next word/concept should not be “abc”
No space between !! and word/concept
Sample Pattern transfer fund !!status
Utterance Match – “i want to transfer funds
– “what is the status of my fund transfer
– “i want to find my fund transfer from yesterday’s status
Utterance not Matching i want to find my fund transfer status
[ … ] 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 parentheses should not be clubbed with the word, i.e maintain a space between the parenthesis and the adjacent word.
Sample Pattern transfer [ funds amount cash ]
Utterance Match – “transfer money
– “can i transfer some cash
– “i want to transfer funds
Utterance not Matching transfer dollars
{ … } Used to define a 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 parentheses should not be clubbed with the word, i.e maintain a space between the parenthesis and the adjacent word.
Sample Pattern transfer { some few my } fund
Utterance Match – “how do i transfer funds
– “can i transfer some funds
Utterance not Matching i want to transfer
( … ) contain a 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 ( transfer fund )
Utterance Match transfer funds from my account
Utterance not Matching i would like to initiate fund transfer
<< … >> Used to find words in any order
Sample Pattern << transfer fund >>
Utterance Match – “transfer funds from my account
– “i would like to initiate fund transfer
Utterance not Matching i want to transfer
‘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 ‘like to transfer fund
Utterance Match I would like to ransfer funds from my account
Utterance not Matching 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

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”

Pattern 3: 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 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

Menu