1. Home
  2. Kore.ai Conversational Platform
  3. Bot Builder Tool
  4. Train – NLP Optimization
  5. NLP Settings and Guidelines

NLP Settings and Guidelines

Intent Naming Guidelines

Follow the below guidelines when naming your task (intent identifier)

  • Use action verb, an object and possibly a modifier (placed before or after the object). Typically, an intent name consists of 2 to 4 words.
  • Use less than 5 words to convey the purpose of the task
  • Use the same verb in different tasks if the action is similar (e.g. Show Issue / Show Report instead of Show Issue / Get Report)
  • Avoid single-word actions
  • Avoid determiners (the, a, my, that, etc.)
  • Avoid digits but if you cannot, always use the numerical form
  • Avoid Kore.ai platform terms such as task, alert, action, cancel, discard, amend, webhook
  • Avoid using a potential entity in an intent name (e.g. Get Weather Today, where today is a potential entity)
  • Don’t use special characters such as () & / \ $ [ ] + *
  • Don’t use punctuation such as – , . ! ? ‘ “
  • Don’t use pronouns (i.e. Show Me All Issues)
  • Don’t use terms related to the bot name (e.g. Create Asana Task)
  • Don’t use a word both as a verb and as a noun (e .g. Update Issue / Get Updates)

On-Demand tasks (Actions, Dialog, Information tasks) should always contain an action verb, an object and possibly a modifier (placed before or after the object). You should map almost all actions to the form “ how + what” and complete the sentence “the goal is to”:

  • Do Something
  • Get Status
  • Send Detailed Report
  • Email Report Critical
  • Get 3 Day Forecast

Alerts should always contain an object and possibly a modifier (placed before or after the object). Avoid using verbs in alert altogether. Avoid using the word “alert” in an alert name. Alerts should be mapped to the form “ what ” and complete the sentence “alert me on:”

  • Something
  • Status Updates
  • Critical Status Update
  • Changes

Patterns

While using synonyms is great for words used in the name, users may sometimes refer to a task using slang, metaphors, or other idiomatic expressions. For example, a task name might be ‘Get Current Weather’, but the user inputs, ‘What’s happening with today’s rain situation’. In such cases, none of the words used in the task name are used, yet the input has the same meaning. To optimize accuracy and recognition of the NLP interpreter for your bots you can create patterns.

When the NLP interpreter matches a synonym to one task or field, and a pattern to a different task or field, the pattern match is prioritized and used for recognition over the synonym match.

Note: Patterns are evaluated in the order of their listing. So ensure when adding patterns add in the order of most restrictive to least restrictive.

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 – , . ! ? ‘ “

Pattern Operators

  • AND : ( X Y ): An ordered relationship of words in sequence. 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 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 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 weather !forecast) are different. The utterance “get forecast for the weather” matches the second but not the first.
  • Optional: {X}: Example – {phone} If the user utterance is “Get me a phone number” or “get me a number” the platform will treat it equally.
  • Concepts: ~: Platform has a large set of inbuilt concepts that developers can use to define a pattern. 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 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: <, >: Example – ( what is love > ) will match “Do you know what is love?” but will not match “I am in love, can you help
  • 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 Example – ( I ‘like you ) This matches “I like you” but not “I liked you”.

Entity Patterns

As above, to detect entities developers can use a combination of Entity patterns and NER training. Entity patterns guide Kore as to where to look for a valid value for the entity. It is possible for an entity pattern to be found in several places in a sentence and Kore will extract the value from the first instance that has a valid value. Apart from the task pattern guidelines above, follow the below guideline for entity patterns:

  • Include the positional wildcard * that indicates the expected position of the entity ( i.e. “(from * to)”, “(in * >)” ); without it the pattern is invalid.
  • Use words that should be present in the pattern before and after the position of the entity. Words after the positional wildcard help to delimit the search range for a valid entity value.
  • Use start and end of sentence symbols ( “<” and “>”) to separate the positional wildcard, but these are not strictly necessary because the Bot Builder tool does not cross a sentence boundary to extract an entity value (except for a Description).
  • Don’t use other positional wildcards in your field pattern. All field patterns are processed in the same way and all other positional wildcards except one are ignored.
  • Don’t use field names or their synonyms in patterns Entity patterns only consider up to two wildcard words between the specified words.

For more information on how to add patterns, see Managing Patterns.

Synonyms

Synonyms need to be used when the words used to identify an intent/entity can be used interchangeably. Synonyms can be defined for both intents and entities. Each intent has a name, for example, if your intent name is Guided Search. There are many synonyms that a user might enter to start this task, such as “browse products,” “Show me makeup,” or “show me products.” As a developer, you should limit the name of a task to only two or three words. And then consider synonyms for each of those words.

For example:

  • Browse – Find, Search
  • Product – Makeup, Goods, Kit

Also consider misspellings, such as:

  • makeup – make up

Synonyms should be ideally defined only for words defined as part of the task name. The synonyms added at the bot level are applicable for all the tasks, i.e. when a developer adds a synonym for a word in Task A, those synonyms are also used for any other tasks with the same words in the task name. For example, synonyms defined for the word browse in the Guided Search are also used for the Keyword Search. Synonyms can (and should) be used to increase the number of variations that we expect from a user requesting an intent. They supplement existing intent name with alternative wording, while not being so generic as to match everything. Remember that synonyms are unidirectional so foo=bar does not mean bar=foo.

The general guideline for Synonyms:

  • Use words in their canonical forms (i.e. infinitive verbs, singular nouns)
  • Use lowercase both for words and their synonyms
  • Keep synonym phrases to less than 5 words
  • Use the US spelling of words (i .e. “normalize” instead of “normalize”)
  • Use intent over meaning (i .e., “get” is a good synonym for “show” if the context of the action means “find and display”)
  • Don’t add synonyms to determiners or pronouns (the, a, my, that, etc.)
  • Don’t use a synonym that could match in two conflicting tasks
  • Don’t use special characters such as () & / \ $ [ ] + *
  • Don’t use punctuation such as – , . ! ? ‘ “
  • Don’t assign synonym to multiple words (e.g. this is wrong: wrong, bad)
  • Don’t add synonyms to digits
  • Don’t use the phrasal form (i.e. don’t use “lookup” as a synonym; simply use “look”)
  • Don’t abbreviate to less than 2 letters

Synonym operations

A match between the user input and synonym for Entity (only for List of Values and Lookup types) identification can occur in one of the following ways:

  • Partial match – this is the default behavior whereby one or more words in the input should match one or more words for a given synonym. For example, user utterance ‘debit card’ will match the synonym credit card.
  • Exact match – here the input should contain all the words for a given synonym. For example, ‘add-on credit card’ will match “credit card”. But debit card will not match “credit card”. To trigger exact match the synonym should be enclosed within double quotes.
  • Full match –  the entire input should exactly match a given synonym word. For example, ‘credit card’ should match <credit card> but ‘my credit card’ should NOT match <credit card>. Similarly, ‘credit card’ should not match <my credit card>. To trigger exact match the synonym should be enclosed within angular brackets.
Note: Synonyms can be added to identify intents as well as entities. Entity identification is triggered only after an Intent is identified.

For more information on how to add synonyms, see Managing Synonyms.

Standard Responses

Standard Responses are template messages that the platform uses to respond to specific situations during a conversation. Examples of these situations include resolution of ambiguous user inputs, requisition for authorization, obtaining confirmations, informing about interruptions and resumptions, and more. Standard Responses are categorized into the following:

  • Statements
  • Greetings
  • Queries
  • Errors & Warning
  • Questions and Choices.

While the platform does come with canned responses, developers are encouraged to customize these messages as well as add variations. To provide a seamless end-user experience across the conversational journey, developers may have to review each of the Standard Responses to ensure that they fit the overall persona/theme of the bot. Standard Responses can be plain text messages or can be generated through JavaScript, to compose dynamic messages and templates for supported channels. Where applicable, Standard Responses support contextual tags that help the developer in customizing the messages. For example, when user requests for what a bot can do, bot responds with a message ‘Here are the tasks I can perform for you. <list-of-tasks>’. In this example, the developer may choose to modify this message and reuse the tag <list-of-tasks>where appropriate. These tags are replaced with the actual text context during the conversation with run-time values.

Bot Ontology-Based Knowledge Graph

For executable tasks, the intent is identified based on either the task name (used in the Fundamental Meaning model) or machine learning utterances defined for a task. This approach is appropriate when a task can be distinctively identified from other tasks, using language semantics, and statistical probabilities derived from the machine learning model. In case of FAQs, this approach may not fare well as most of the FAQs are similar to each other in terms of semantic variation, and will require additional intelligence about the domain to find a more appropriate answer. Kore.ai’s Knowledge Graph-based model provides that additional intelligence required to represent the importance of key domain terms and their relationships in identifying the user’s intent (in this case the most appropriate question). We will use the following two examples to explain the different configurations required to build a Knowledge graph

 

Example A Example B
Consider a bot trained with following questions:

  • A1: How to apply for a loan?
  • A2: What is the process to apply for insurance?
Consider a bot trained with following questions:

  • B1: Can I open a joint account?
  • B2: How do I add a joint account holder?
  • B3: How can I apply for a checkbook?
  • B4: How do I apply for a debit card?

 

The following are a few challenges with intent recognition using a typical model based on pure machine learning and semantic rules:

  1. Results obtained from machine learning based models have a tendency to produce a false positive result if the user utterance has more matching terms with the irrelevant question.
  2. The model will fail when the bot needs to comprehend based on domain terms and relationships. For example the user utterance “What is the process to apply for a loan ?” will incorrectly fetch A2 as a preferred match instead of A1. As A2 has more terms matching with user utterance than A1.
  3. This model will fail to fetch the correct response if part of a question is stated in a connection with another question. Example A: the user utterance “I have applied for a loan, can I get insurance” will result in the ambiguity between A1 & A2. Example B: User utterance “I have opened a joint account, can I have a debit card“ will incorrectly match B1 over B4

In Kore knowledge graph model, having all the questions at the root level is equivalent to using a model based on term frequency and semantic rules.

Key domain terms and their relationship

Identifying key terms and their relationships is an important aspect of building ontology. Let ’s understand this using our sample Example A. Both A1 and A2 are about an application procedure, one talks about applying for a loan while other talks about applying for insurance. So, while creating an ontology we can create a parent node “apply” with two child nodes as “loan” and “insurance”. Then A1 and A2 can be assigned as child nodes of “loan” and “insurance node” respectively.

Representation of knowledge graph:
Example A

Similarly, in the case of Example B, the graph will be as below

Capabilities of a Graph Engine

  • Ease of training using synonyms: Kore.ai’s Knowledge Graph has a provision to associate synonyms against a graph node. This helps capture the variation in a question. Example: In Example A above, a user can put “get” as a synonym to “apply.”
  • Better Coverage with alternate questions: Knowledge Graph has a provision to add alternate questions. This helps us to capture the various ways a user might ask the same question. In Example B above, for the question “How do I add a joint account holder” we can add an alternate question as “Can I add my wife as a joint account holder
  • Improved accuracy: Ontology-driven question-answers reduce the possibility of false positives. For example, for the user utterance “What is the process to apply for SSN ” a term frequency based model will incorrectly suggest A2 as a match. An ontology-driven model has the capability to prevent such false positives.
  • Weighing Phrases using classes: Kore.ai’s graph engine has introduced a concept of classes for filtering out irrelevant suggestions. See the below section on classes for a detailed explanation
  • Ability to mark term importance: Kore.ai’s graph engine has a provision to mark an ontology term as important. For example, in a question, “How to apply for a loan”, “loan” is an important term. If a ‘loan’ keyword is not present in the user utterance, then it makes little sense to fetch A1. Whereas in term frequency based model a user utterance “How to apply for a” will incorrectly fetch A1.
  • Ability to group relevant nodes: As the graph grows in size, managing graph nodes can become a challenging task. Using “organizer node” construct of ontology engine, bot developer can group relevant nodes under a node.

Knowledge Graph Classes

When using class ensure you use it judicially as over usage may result in false negatives. When using classes ensure:

  • Good coverage of classes
  • Classes should not get generalized improperly
  • All the FAQs get tagged to mutually exclusive classes.

Following is the example of how classes work: Let’s say we create a class called Request and add request related phrases to it. If the user says ”I would like to get WebEx” and “I would like to get” is trained for the Request’ class, this FAQ is only considered across the Knowledge Graph paths where the word request is tagged with. This is a positive scenario. But if the user says ”Can you help with getting WebEx”, and we did not have similar utterances trained for the Request class, it gets tagged with ‘None’ class and this FAQ is only used with the paths where ‘the word request isn’t present. This results in a failure.

Another possibility is that if user says “I want to request for help fixing WebEx” and we have trained the Request class with some utterances having ”I want to request “, and based on the training provided across all classes, the engine may generalize and tag this feature (phrase containing I want to request ) to the Request class. In this case, if the Request class is not present in the help path for WebEx, this results in failure of identifying the input against ‘help’ -> ‘WebEx’.

The cases where classes are useful is when we have a mutually exclusive set of FAQs. For example, if we have a set of FAQs for Product issues and also a set of FAQs for Process for buying a product.

FAQs for Process for buying a product:

  1. How do I buy Microsoft Office online?
  2. What is the process for buying antivirus software

FAQs for Product issues:

  1. I am having issues installing software
  2. How to resolve an issue with antivirus

When a user says ”What is the process for fixing antivirus when it doesn’t work”, the engine may find that this input is similar to both A2 and B2, and may present both of them as suggestions. We know that Issue is mutually exclusive to buy, and it does not make sense present buy related FAQs at all, in this case. The opposite (matching Issue FAQs for buy related question) may be a much bigger problem. To solve this, we will create two classes, one for type issue and another for buy. Every input will be classified into either buy or issue and only the relevant questions will be used in finding an appropriate answer.

Was this article helpful to you? Yes 3 No