An Intent Beginning
The first thing we needed to do for the viaSport Accessibility Sport Hub (ASH) was to determine which basic questions we wanted to answer. In bot terminology or more specifically the Microsoft Language Understanding Intelligence Service (LUIS) what “intents” were we trying to decipher and respond to. The challenge is not be very specific but keep it simple. Also, just identifying the “Intent” isn’t good enough. Once we had that we had to think through the application development on how we would respond to a specific intent. Microsoft Cognitive Services are great and the deciphering part but ultimately YOU, the developer have to sort out what to do with the information provided.
The first intent we decided on was “How To Coach”. Basically the original mandate was to provide assistance to coaches who needed material that would guide them in coaching athletes with disabilities. That information exists but is scattered and not necessarily readily available. To make this work in our Bot application we had to do three things:
- Use LUIS to define the “How to Coach” intent. This means adding the intent, providing a number of examples of possible questions that equate to “How to Coach”, training and publishing the service.
- Create some sort of database to hold the references that viaSport and reviewed and listed and make sure those references are tied to the new intent. We wanted to have more intents later so allowance had to be made for this.
- Modify our Bot to accept the “How to Coach” intent and handle it. This means recognizing the intent, querying the database that contains references for ones that match the intent and displaying it. This part, good old coding, is the part that was expected to take the longest and was the highest risk area.
I’m hoping to cover each of these problems over the next few blog entries beginning with LUIS. There is a lot to consider when you begin defining LUIS intents that may not be obvious when starting.
Is An Intent Enough?
Now that we’ve decided on an initial intent it’s time to consider what we will do with it. In an information retrieval bot you ideally want to provide very specific results. If your inquiry returns 200 possible answers, what good is it really? So before we go to https://luis.ai to define our intent, lets consider what we really want to provide.
We really need to know more than just “How to Coach”. LUIS provides for a way of defining more details in the intent. So all we need to do is come up with key bits of information that will help us narrow down the search for relevant resources for our coaches. First, it’s obvious that the sport selected will have a big impact on the coaching information needed. So with the intent of “How to Coach” we will want LUIS to extract from the natural language query from the coach what sport they wish to know about. Sport will narrow down the information available but we decided on one more factor… disability. Within each sport there are different disabilities that require different coaching techniques. By adding that factor, the coach asking the question can get pretty specific with what they want.
Now we have an intent and two parameters, or what LUIS calls entities, that we can extract from the natural language inquiry. All we need to do is create our LUIS application.
Working with LUIS
Start off by going to https://luis.ai. You will need to logon with a Microsoft Account like @outlook.com or @hotmail.com. If this is your first time with LUIS, there is a “Login/Sign up” link right on the home page where you can sign up (for free) for the service.
There have been many improvements since we started the viaSport project. It used to be that you had to really spend a lot of time training it to recognize relevant entities but now, with just a few hints, it will generate many of the terms you need and then be able to deduce many more during operation.
The following steps were used to create the LUIS app for the viaSport Accessibility Sport Hub (ASH).
- It may seem really simple for the very good reason that it is very simple. Begin by tapping the “Create new app” button on the “My Apps” page. Give the app a name and description although the description is optional. I pretty much only work with English bots at this point so select English for the language. As of this writing there are 12 languages already available.
- Tap the “Create new intent” button to add our “How to Coach” intent. Give the name of the intent when prompted. This is the name we’ll see in our Bot app when we are seeing which intent LUIS interpreted from the original input. You might want to make a note of it.
- Now all you need to do is give it some examples (what LUIS calls utterances) of the query that should be interpreted as “How to Coach”. Let’s do the first one with a sport and disability. We’ll then have an example where we can identify our chosen entities (Sport and Disability).
- How do I coach Hockey to a person who is an amputee.
- Tap on “hockey” so you can mark it as an entity. In the popup type “sport” then click “Create new entity”. We want this one to be a “list” entity as we are going to limit this to specific sports. Select List from the Entity Type drop down. After selecting list you can enter synonyms for hockey. I wish that this had been available when we built ASH. We had to build our own synonym system instead.
- Do the same thing with “amputee” creating a List entity called “disability”.
- Now add 4 more utterances that contain a sport and disability. You can use words other than coach, like teach or any variant you wish.
- if you indicate a sport or disability different than our original ones, you’ll need to tap on the sport or disability and create a new synonym.
- Lastly we want to add some more disabilities and sports to our lists of entities we’ll recognize. In one of the utterance tap the word “sport” then “Manage Entity”
- Notice right away that at the top are listed a whole bunch of other sports. Now, ideally we want to add sports that we will be providing information on but you can go ahead and add a bunch of sports for now. In our case we needed to add para-specific sports like para-skiing, wheelchair basketball, etc…
- We’ll want to do the same thing for our disability entity.
One of the keys to a great app is preparation and planning around what you will recognize. If you think that you’ll have a sport called Hockey but there will be lots of other ways to describe hockey but will, for our purposes, be the same, then add lots of synonyms like, in our case, “sledge hockey” and “para-hockey”.
Once you have done all of the above, all you need to do is train and publish your LUIS app and you’ll be ready to call it. Just click the “Train” button then you can go ahead and test it. Once you are happy, tap the “Publish” tab and publish the app.
You will need the Endpoint listed at the bottom of the publish page. Make a separate note of the Key String (if it’s not there, you’ll need to create it) and the App Id (looks like a GUID and can be found in Settings tab).
We are now ready to move to our bot app in Visual Studio to make it all talk to LUIS and start understanding natural language.