Earlier this year I had the opportunity to help a local non-profit sports organization (NPO) get information on sport disability and accessibility out to athletes, teachers, parents, coaches and sport leaders. I was fortunate enough to work with some great experts from the NPO as well as Microsoft. After some initial discussions we came to the conclusion that we would go with a natural language interface otherwise known as a bot. We decided on using Microsoft’s Bot Framework and at least one Microsoft Cognitive Service, the Language Understanding Intelligent Service (LUIS). This blog will be about some of the decision making that went into choosing these technologies instead of others and what benefits were gained by our choices.
Chat or Click
When we first sat down with viaSport British Columbia, the NPO to discuss their needs, they made it very clear they wanted something different. There have been plenty of attempts in the past to provide information to their constituents and there were examples of other organizations, such as the Canadian Paralympic Committee, that have provided some of the information.
One of the methods used in the past was to have a series of cascading combo boxes where you selected some property which would then set a selection list for the next combo drop down box. You would work your way through these items until you came to the end. One of the problems with this is it assumes a certain level of knowledge of what question you want answered. You also have no flexibility in decisions made during the process. To continue you must select something even when “your” option wasn’t available. viaSport (our NPO) wanted something a bit more friendly and more in line with the way its members commonly communicated with each other. Sending messages and typing on their phone or computer using natural language seemed to be a natural (pun unintended) fit. We decided on chat instead of click and implement a chat bot using the Microsoft Bot Framework and natural language with LUIS and Microsoft Cognitive Services. Later on, we added the use of some other cognitive services.
The initial goal was to simply allow their constituents to visit their web site and ask, in plain language, for information specified by sport, disability and person asking for the information. For example, a coach might ask “How do I coach swimming to a paraplegic” and the goal would be to provide reference material helping that coach to provide guidance to the athlete specified. To accomplish that goal we needed only two elements and a hosting service. The Microsoft Bot Framework could nicely handle the conversation part of things (back and forth), with a C# code behind, doing the lookup of the information and Microsoft’s LUIS Cognitive Service to provide the natural language understanding of the questions being asked.
Ultimately the thing that would make the project a success, as with most projects, is the quality of the data or information we could provide to the the clients. The whole point of the exercise was to provide curated information to the people who needed it without the massive amounts of information you would get from a Google or Bing search. So, combined with our bot and natural language processing we used Microsoft Azure SQL database to store the curated list of information and a Microsoft Azure App Service. Setting of all Cognitive Services is done through Azure also, so signing up, initially, for the free trial let us move forward with a prototype almost immediately.
Starting Coding is Fun!
I chose C# as the language of choice for a couple of reasons. I could have done the bot project in NodeJS but chose not to. First is that I’m very familiar with C#. I’ve written hundreds of applications using C# and it seemed the logical place to start. Also, I realized very early that not only did I have to create the Bot but an administrative tool for viaSport to manage their curated links and content. That tool would be best written in C# as a UWP app.
So, to begin we used a template provided by Visual Studio 2015. It created a very simple template that didn’t include anything to do with LUIS and required that all the connectivity to LUIS had to be done by me. The good news is, since we created our bot, there now an easier way. Inside Azure, you can simply create a new “AI + Cognitive Service” service and one of the choices is “Bot Service (Preview)”. This creates the whole framework for you to begin, including all the hooks you need into LUIS. It’s like magic!
Once you create the Bot Service you are given a choice of 5 (currently) different templates for the bot using two different languages, C# or NodeJS. The templates cover everything from a simple “echo bot” where it just echo’s back the text input to a Q&A type bot to a bot using Azure Functions to the one we want, a bot template that will automatically bake in Language Understanding (LUIS). Having that template would have been very helpful in the early days of creating this bot. Once you have chosen your template the template wizard will walk you through all the options you need to create that bot including assigning the App Id (needed for publishing) and password (take note of all the ids and passwords, you won’t be able to get them later). Once you have created the App, it will provision the LUIS service for you and you will be ready to start defining intents (basically an intent is what the natural language will be interpreted as, for example “How to Coach”).
All the starter code with all the keys already in place will be created for you. You can easily hit the road running. The Bot Service even provides an on-line editor that looks a lot like Visual Studio or you can download the source and use it with Visual Studio 2017 (even the free community edition) or lastly, have it uploaded to a source control provider like Visual Studio Team Services or GitHub. You could literally deploy the Bot code as is and start using it (once you put some intents in). The on-line editor is surprisingly useful and lets you get going right away. You can even run and test your bot or debug it using the Bot Framework Emulator (they give you a link to download and install the emulator).
The End of the Beginning
At this point we had our prototype. The next steps I’ll outline in a later blog involved building the back end database containing the content and an administrative tool for managing that content. My goal was to hand off the project to viaSport without them needing to call me for every little thing. I didn’t want to be a dependency for them moving forward. I made myself available to help out but most of what they wanted to do they could easily do on their own, including manage the content, track usage and other telemetry and make improvements to the bot understanding, all without having any developers on staff or needing to contract one.
As I work through the building of this application over the next few blog entries, we’ll look into Windows UWP App development, other Cognitive Services, inclusivity considerations and telemetry.
Great job for publishing such a nice article. Your article isn’t only useful but it is additionally really informative. Thank you because you have been willing to share information with us. Accessibility Planning For Events OntarioReplyDelete