Bixby Developer Center

Match Patterns

This capsule demonstrates how to use match patterns in your actions.

Download Capsule

Note

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:

UtteranceGoal
"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)}.")
}

View master on GitHub

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
}
}

View b8d70b1 on GitHub

  match {
Business (business) {
min (Required)
max (One)
from-output: CallBusiness
}
}

View b8d70b1 on GitHub