This capsule demonstrates how to use match patterns in your actions.
Because you cannot submit a capsule with the example
namespace, in order to test a sample capsule on a device, you must change the id
in the capsule.bxb
file from example
to your organization's namespace before making a private submission.
For example, if your namespace is acme
, change example.matchingPattern
to acme.matchingPattern
.
Different goals for Bixby might take the same concept as an input but trigger different result views. The result views specify different match patterns.
In this sample capsule, which simulates a simple business search, there are five training samples with different goals, which are listed in the following table:
Utterance | Goal |
---|---|
"call business" | CallBusiness |
"find a business" | FindBusiness |
"what are the categories" | Business#categories |
"what is the rating" | Business#rating |
"navigate there" | NavigateThere |
The FindBusiness
action simply outputs a Business
model, whose result is displayed by the Business_Result
view.
After a business is found, "what are the categories" and "what is the rating" demonstrate property projection: the goals are properties of the Business
model. This is demonstrated in the BusinessReview.dialog.bxb
and BusinessCategories.dialog.bxb
dialogs, which match on BusinessReview
and BusinessCategory
respectively, using from-property
to indicate the concepts being matched are properties of Business
.
dialog (Result) {
match {
BusinessCategory (this) {
from-property: Business (business)
}
}
template("#{value(business.name)} has #{joinAs('value', this)}.")
}
The Business_Result_From_CallBusiness.view.bxb
and Business_Result_From_NavigateThere.view.bxb
views also use match patterns. Both match on the Business
concept, but use from-output
to specify different goals via property projection.
match {
Business (business) {
min (Required)
max (One)
from-output: NavigateThere
}
}
match {
Business (business) {
min (Required)
max (One)
from-output: CallBusiness
}
}