Yeah, so the terminology I understand in Alexa is:
- “skill” is just the user-visible concept of the whole interaction model, the “Foo” in the user phrase “Ask Foo for …”
- “intent” are families of commands with similar implementation and similar semantics, associated with a label
So for example, you might have a “Cool Restaurants” skill that has intents “FindRestaurantByName”, “FindRestaurantsAround”, “BookRestaurant”, “CancelBooking”, etc.
So the command: “find me Mc Donalds”
would map to FindRestaurantByName(name="McDonalds")
the command: “find me a cheap restaurant nearby”
would map to FindRestaurantAround(price="cheap")
the command: “book at a table at the french laundry”
would map to BookRestaurant(name="the french laundry")
etc.
Genie’s approach is a bit different. We have:
- “device”: a specific backend service that the assistant relies on (which could be your own custom backend)
- “function”: a specific query of information, or a specific API action that the backend provides
- “program”: a sequence of function calls with control constructs, that implements the semantics of a specific command
So for example who ever implements the OpenTable service in Almond would declare a query function called restaurant
with a bunch of output parameters: the name, the price, the location, etc.
And now all the commands that search for restaurants are mapped to a database lookup in that table:
“find me Mc Donalds” maps to @opentable.restaurant(), id =~ "mc donalds";
“find me a cheap restaurant nearby” maps to @opentable.restaurant(), price == enum cheap && geo == $location.here
“book a table at the french laundry” maps to @opentable.restaurant(), id =~ "the french laundry" => @opentable.make_reservation(restaurant=id);
Note how each program, in addition to referring to the function with parameter, has a whole lot of logic in to it, because the command requires that logic. Also note how the last command splits into two API calls.
This approach allows you to compose phrases and it’s how to get to complex queries quickly.
Genie’s NLU can go directly from sentence to program - no intent needed.
Alexa’s NLU cannot deal with programs though: all it knows is intents.
So the best way to integrate the two is to delegate to Genie’s NLU. Alexa would still be in charge of ASR, of course.
If you really want to use Alexa’s NLU, you need a way to map each program to an intent. The easiest way is to take all possible programs (or a reasonably large sample of all possible programs, because programs compose and form an exponential space), and compress them down by unifying the parameters. So for example Genie generates:
“find me cheap restaurants here” -> @opentable.restaurant(), price == enum cheap && geo == $location.here
“find me expensive restaurants here” -> @opentable.restaurant(), price == enum expensive && geo == $location.here
“find me cheap restaurants in Palo Alto” -> @opentable.restaurant(), price == enum cheap && geo == new Location("palo alto")
etc.
you can compress all those programs to a single intent FindRestaurantByPriceAndLocation
with those slots, and then, later reconstruct the full program from the Alexa intent, to pass to the rest of the Genie runtime.
The code you have found does the second step, but we don’t really have tools to do the first step (compiling the list of intents) because you get a lot of intents and that usually doesn’t work well with Alexa.