ok
CHOOSE YOUR LANGUAGE

Intent

  • An Overview
  • Intent IDs
  • Languages
  • Sentences
  • Using References When Defining an Intent
  • Some More Details on the Options when Typing the @ sign
  • Cross Intents

 

An Overview


Whether a Zenbo is able to process a sentence in your app all comes down to this: Has the sentence been defined? Thus, writing sentence patterns in the intent tab page is key to successfully building an app.

Intent is the thing that one plans to do. In our DS system, a speaker's intent is expressed by a sentence conveying his/her intention. The purpose of defining intents is to make the DS capable of recognizing what a speaker is trying to do. Because people can express an idea through different sentence patterns, it is the app developer's responsibility to enumerate all the possible sentences that a speaker might say for a particular intent.

Here is an example. Let's suppose you are creating an intent expressing "I like you". The following three sentences should have this meaning:

  • I like you.
  • I kind of like you.
  • I don't hate you.

While constructed by different words, the three sentences above essentially mean one thing: I like you. You can surely come up with even more equivalent sentences. And the more sentences you create, the more expressions Zenbo can process. Tedious task as it could be, you need to create as many sentences expressing the same intent as possible so that the DS won't fail to recognize the speaker's intent.

See the further discussions below to familiarize yourself with intents.

 

Intent IDs


Firstly, you need to give an ID to each intent so that it can be referenced later while you're defining plans in the plan tab page.

In Fig. 1, we give the intent an ID named where_to_travel.

Fig. 1. Intent ID

 

Languages

Pick a language for the intent. (At this stage, we offer four options. See the picture below.) Let's suppose the intent we are working on has English sentences. In this case, we select English as the intent language. 

The first option is "All languages", meaning the intent sentences are able to be processed and recognized whatever Zenbo's background language is. Selecting others, however, indicates that the sentences can be processed only if Zenbo's background language is set to that language.

In principle, we recommend selecting a specific language instead of “all languages”, so as to achieve a higher overall speech recognition rate. This is because by doing so, there should be no interference between different languages. Furthermore, selecting a certain language can also reduce future debugging and maintenance effort.

Typically we often select "all languages" when the intent references some system entities, or when it references only one concept. In both cases, the "All languages" option avoids the need to repeatedly reference the intents of all languages. 

***Note that there is an option called "Detected By The System", meaning our system will choose the language for you by looking through all the sentences and checking which language they are written in.

Sentences


You are required to create at least one sentence for every intent. And an intent cannot have two duplicate sentences.

A sentence represents one of the various ways of expressing an intent. Usually there is more than one way to express an intent; therefore, it the your responsibility to write down all the possible paraphrases that the speaker might use to convey the intent.

To give an example, considering the following three sentences, although composed of different words, they mean the exact same thing. Thus, they are considered equivalent.

Hardly had I arrived home when my phone rang.
I had scarcely arrived home when my phone rang.
No sooner had I arrived home than my phone rang.
...

You can easily come up with more sentences expressing the same idea.

Hence, you should include at least, but not limited to, all the above sentences. Sounds tedious? It is worthwhile to note that a simple way to circumvent this cumbersome enumeration is to use references, which will be discussed later in this page.

 

Fig. 2. All these sentences mean the exact same thing.

 

Using References When Defining An Intent


It's a good idea to use references when defining intents. As mentioned earlier, you can reference a class by simply typing an '@' and click add @ that pops up below.

 

Reference Classes

When trying to create an intent, you must create all the conceivable sentences that can express it. Enumerating all the possible variations, however, might cause considerable redundancy. For example, "I want to see a movie.", "I want to go to see a movie.", "I plan to go to see a movie." You got the idea. And it is in fact impractical to do so. A better solution is using class references.

In Figure 3, supposing, in the concepts tab page, we have defined a class named myCity instantiated by some city names such as New York and London, then in the intents tab page, we can see that the forth sentence contains the class reference myCity. How to create this orange rectangle is shown in the same figure.

 

Fig. 3. Using the city class reference.

 

System Concepts

Furthermore, our system predefines a set of built-in system entities/phrases you can refer to (they are just some reference classes), thus making the development much more convenient. For those who are interested in our system defined entities/phrases, please see system concepts on the navigation panel. Fig. 4 below shows you how to use the built-in entitybase.geo.city in the fourth sentence definition.


Fig. 4. Using the system.geo.city system.entity.

At this point, we are able to eliminate the redundant sentence definitions that exist in Fig. 4. The results are shown in Fig. 5. Obviously this new version is a lot more efficient and elegant, compared to the previous one.

Note that there are two more new sentences created in this figure because they have the same meaning so they can also be included.


Fig. 5. Reduced sentence definition.

 

Reference Phrases

Additionally, you can reference a phrase in the same way you reference a class. Please see Fig. 6 below to get an idea of how to do it.

 

Fig 6. Phrase references.

 

Note

Supposing your system language is set to English, then the DS can only accept sentences, whether they contain a class or not, written in English. Thus, it is essentail that every sentence contain only English words lest the DS fail to recognize it and produce unexpected results. The same rule applies to the other languages supported in our system as well.
 

Some More Details on the Options when Typing the @ sign


Set Beliefs

Set belief is used to save information of a user utterance in one or more parameters, of which the values you might want to use in the future. You can retrieve the values of parameters under the plan tab.

  1. Set Phrase Beliefs 
    To set a phrase belief, follow the left screenshot in Fig. 7 below. In this figure, buy_a_vehicle is a phrase from which we extract a belief called buy_a_vehicle_belief. Owing to the fact that the phrase buy_a_vehicle is composed of "buy a" + {the vehicle class}, we can set the phrase belief concept to vehicle so that if someone says “I want to buy a truck”, the word truck will be extracted and assigned to the belief buy_a_vehicle_belief (of which the value can be manipulated afterwards under the plan tab).
  2. Set Class Beliefs 
    To set a (class) belief, follow the right screenshot in Fig. 7 below. The second sentence is made up of "recommend" + {the vehicle class}. We can extract a belief from this vehicle class. Thus, supposing someone says, "recommend a truck", the word truck will be extracted and assigned to the belief vehicle_belief (Again, this belief can be used later under the plan tab.).


Fig. 7. How to Set a Phrase/Class Belief

 

Order

If the order box of a belief is checked, it means that the order of the class/phrase references in the sentence where the belief is extracted matters.

In Fig. 8, we see that both order boxes of adverbs_of_time and anEvent_nounClause are not checked, which means their orders are interchangeable. Therefore, let's say this intent can cover the sentence

"He said on Wednesday he wanted to see you."

And since the two reference classes are not ordered, this intent can of course also cover the sentence

"He said he wanted to see you on Wednesday."

Were these selection boxes checked, only the first sentence would be covered.

 

Optional

When you are writing a sentence, if the optional box is checked, it means that the class/phrase references in the sentence is optional; thus, the sentence will be chosen by the DS irrespective of whether or not the speaker says an instance of the class/phrase references in his or her utterance.

Again in Fig. 8, the reference class adverbs_of_time is optional, for its optional box is checked, meaning the presence of an adverb of time is optional. Hence, let's say this intent can cover the sentence "He said on Wednesday he wanted to see you." And since the first reference class is optional, this intent can also cover the sentence "He said he wanted to see you." If the first reference class were not optional, the second sentence would not be covered.


Fig. 8. An example of check boxes and their functions.

 

Set Phrase Belief

"Set phrase belief" is used to extract information of a phrase from the speaker's utterance.

 

Exception Set

While you are defining a sentence of an intent, there is an option for you to specify an exception set, which is a set of instances of a class. The instances included in the exception set won't be given any consideration when they are part of a sentence. For example, suppose the DS is searching for the sentence defined as "I lived in {...} for three years.", where {...} is a class of country names and the exception set={Germany}. Then the sentence---"I lived in Germany for three years." won't be matched even though Germany is a country, for the word Germany is in the exception set.

 

Cross Intents


As you become more and more involved in developing your dialogue configurations, you will probably be hearing other developers talk about "cross intents" a lot. It must be quite an important term, or we wouldn't have given it a special name. So what is it? By our definition, a cross intent is an intent referenced by any plan having no input context. One scenario where cross intents might be useful is that you are planning to create a plan to open one of your dialogue configurations. Supposing you are writing a cooking dialogue, then you will probably create a plan with no input context, and the plan references an intent with a sentence: "open the cooking app". (Thus, by definition, the intent is a cross intent.) Hence, whenever someone says, "open the cooking app", the plan referencing the cross intent will be triggered since it needs no input context.

If you want more details on how to do this, please refer to the Hello World Template we created for you, where we made a cross intent to open the Hello World app. 

It's important to point out that our system imposes a restriction on using cross intents: You must enter an activity name in the Launch Activity field in the Project Info window. (Click Project -> Info to go there.) if you are using cross intents in your project.  

Go To Top