Teneo Developers
Table of Contents
Was this page helpful?

Share to

Writing good examples

Much of the performance of your bot depends on how well it recognizes user inputs. Writing good examples for classes and conditions is crucial for training the bot. These examples can be written inside the flow and used to generate a match requirement. Doing this will help the development in the Quality Assurance (QA) stage as the examples inside a flow are used for testing with Auto-Test.

After completing this chapter, you will know how to write good examples for your flows.

Frame 1

Learning examples for classes

One of the biggest advantages of using machine learning algorithms is that you can use them without needing linguistic skills. When using a classifier, for example, you don't need to understand the exact characteristics that define what an input is about. You can focus on collecting example inputs for the subjects you want to cover and, once you have trained a model using that data, you let the model do its magic. That makes it relatively easy to train a system to understand natural language without needing linguistic skills.

Classes in Teneo are built based on training examples. This is a very common approach when building triggers. Generally, the classes are dependant on one structure.
Here is a list for things to think of when creating learning examples for Classes.

  • Use natural language.
    • Formulate complete sentences, as if you are addressing a human being. Some fluff is alright, but try to avoid it and do not overdo it.
  • Make ample use of synonyms for verbs and nouns.
    • This is important as a variety of words used will help the bot to correctly respond to more varied input.
  • Do not use very short examples (keyword-like inputs).
    • Short examples are better covered by conditions. Instead, try to write long examples, which our classes excel at working with.
  • Do not use context-dependent examples.
    • Replace occurrences of pronouns by nouns or verbs. For example, avoid the use of the word 'it'.
  • Use different sentence structures to create as much variation as possible.
    • For example, the user ordering coffee can be written as, 'I'd like a coffee' and 'Can you make me a coffee?'. This is mainly so the class covers a much broader range of inputs.
  • Stay focused: all examples should lead to the same answer.
    • While trying to come up with training examples, think of whether it would make sense to give the same answer text to several different inputs. Multiple sentences are allowed but keep in mind all of the above.
  • Create at least 10 training examples to start with.
    • The optimal level is 20 training examples, but it is good practice to keep adding new examples to further educate the model based on its performance.

Classes can be found and managed inside the Class Manager.

Examples for conditions

This is where the advantages of the linguistic model come into play. When using a linguistic approach, you create a condition that looks at the words, their order, synonyms, common ways to phrase a particular type of question, etc. In other words, you look at the linguistic patterns of inputs and you capture them in what we call a 'language condition'. The advantage of this approach is that you have full control over language understanding; a human can read and fine-tune the conditions where needed.

Conditions are usually built in transitions or for triggers with a very specific purpose. Here is a list for things to think about when creating examples for Conditions.

  • Focus on the essence of what this trigger (or transition) should recognize.
    • Having a clear goal will help you with creating the relevant conditions and examples.
  • Write short but complete sentences; avoid unnecessary fluff.
    • Unlike classes, conditions are great with short sentences, so make sure to write short sentences with a variety of words.
  • Try to create sentences with different structures. Be creative.
    • For example, 'I'd like a coffee' and 'Can you make me a coffee'. In essence, this will help the condition to find paths and build rules based on those paths.
  • Focus on the nouns and the verbs that matter.
  • Only use adverbs and adjectives when they are relevant.
    • Avoid use of these words if they do not provide any important information. This is mainly so conditions can be built from a more generic approach and apply to a wider range of inputs.
  • Give all sentences more or less the same degree of exactness.
    • Do not let one input be a subset of the other.
      • Good example: 'I'd like a coffee' and 'Can you make me a coffee'
      • Bad example: 'I'd like a coffee' and 'I would like a coffee'.
  • Very short examples, e.g. keywords, get their own trigger.
    • This is demonstrated in this guide and works very well if you want to make your bot look smart and keep track of missing functionalities.