There has been a lot of very advanced research on developing algorithms which can analyze facial expressions, voice authentication and language understanding. Microsoft has decided to make this research available by creating series of products which allow people to incorporate advanced research into their applications. The cognitive service that investigated first was the Language Understanding Intelligent Service [LUIS].
Teaching the Computer to Understand Text with Cognitive Services
There is a very good example of how to make LUIS understand text here. In the sample, you can click on a button containing text or enter text free form. What LUIS does with the text is shown on the grey box on the right, JSON script is returned showing what LUIS score LUIS gave to the intent “TurnOn”. LUIS does not turn on lights for you, but there is a really good example of some code where people are using LUIS to control their home automation.
Before you can implement a solution with LUIS you need to define the intents which are listed in the JSON script. An intent is an action you have defined. Some example intents might be to Find a Hotel in Seattle or Tell me Amazon’s Stock Price or a lot of the other things people have Alexa do for them. The scope of what you would have LUIS do for you is a lot more focused, as the number of Intents allowed is limited, and you will have to write the code to perform the Intent.
Steps to Understand LUIS Text
As right now LUIS is in preview mode, and therefore free, this is a great time to start learning the new technology. To get started, you will need to create an account at www.luis.ai, and once that is complete, create a New App. When creating a App, you will need to select a language, and a number of different languages are supported. No key is required, as a free key will be generated later. An App requires Intents, LUIS evaluates text to see if it indicates the intent is likely. The text that is evaluated is compared to an Utterance, which you also need to create. For example, if you have an intent for SearchHotels an utterance would be Find me a Hotel. While this is a perfectly good utterance, there is no reference to a location, which is something pretty important when looking for hotels. Entities are the descriptive parts of the Utterance. If I said show me hotels in [$geography] and replaced what was in the brackets with a city, then I would have a better idea of what hotels to return. If I add the prebuilt entity geography, then LUIS will be able to describe a location, which of course can be added to my utterances if I put square brackets around the entity name and a dollar sign $ in front of the name. I can add words people may use to describe a location with Features. If I add the word near, I can add the synonym catty-corner so that LUIS will understand that that word means near. Once I have a complete list of Intents, utterances, and features, I can train the application for it to be tested and used in a component.
Once I have a customized App created for LUIS to understand text, I used that to create a BOT to explore how I could use the rules I implemented in the website. I used the Microsoft Bot Framework to create an application which calls the LUIS component I created. In the code I created a reference to the code I created in LUIS, so that I could call it from within my application. As I don’t write much about C# code here, I didn’t include the code here, but I would be happy to share it if you would like. Just drop me a line and I will post it.
Data aficionado et SQL Raconteur