In this article, we’ll learn about LUIS – Language Understanding Intelligent Service provided by Azure. We’ll get into the details of how LUIS understands our natural language and then go ahead to build an app that can detect the intention of our text. We’ll go through a step-by-step process to create a weather app that can identify if we are asking about the weather situation of any city and country.
LUIS (Language Understanding Intelligent Service)
LUIS is a cloud-based service for understanding text which basically solves problems in the domain of Natural Language Processing and is simple to use. Moreover, it can easily be integrated with our software development processes. Furthermore, the best part with the LUIS is that it requires no prior AI experience, thus making it easier for organizations to not have a dedicated AI team. Now, the application can be enabled with AI through LUIS without having to hire a team of mathematicians and computer scientists.
How does LUIS understand our natural language?
First of all, it creates the intents and entities. Next, the utterances are added. For instance, Book a flight to California. Next, precision is increased through training, testing, and refining. Finally, the trained model can be used with applications such as smart apps and chatbots by publishing and deploying them in the cloud.
Illustration
Utterance: A plain sentence in English
Intent: What is the speaker trying to do?
Entity: What things – objects, location, etc. What is the speaker referring to?
Source: Stephan Bisser
Example
Turn on the light for the Living Room
Utterance: Can you please turn on the lights for the Living Room?
Intent: Turn light on
Entity: Room = Living Room
Create a Conversation App
Now, let us learn to create a conversation app using LUIS which can understand our language to find out about the weather.
Step 1
First of all, login to the Azure Portal.
Step 2
Click on Create a Resource
Step 3
On the Search Bar search for Luis or language and Select the Language Understanding
Step 4
Click on Create
Step 5
Choose both on the Create Options and fill up rest of the details as shown below. You can easily use the free tier resources for this.
Now, Click on Review + Create
Step 6
Once the Validation is Passed you can then click on Create.
You can see the update in the notification.
Step 7
The deployment will get in progress and update you with your deployment is complete once done.
Click on Go to Resource Group.
Step 8
You can now see, the weatherapp is now running which is basically a Language Understanding app in Azure.
Step 9
Now, go to the LUIS portal and select your subscription of use. To change the subscription click on the Setting bar.
Step 10
Find your Azure Subscription and LUIS authoring resource. You can create a new resource if you don’t have one.
Once done, click on Confirm.
Step 11
We can see, the conversation apps list is empty. Let us create a new app by clicking on New app.
Step 12
As we are creating a weatherapp right now, let's name it weatherapp and select the prediction resource.
Now, click on Done.
If you want to learn more about LUIS and how to make Chatbot using LUIS, watch this video.
Step 13
You’ll be welcomed with a guide to create an effective LUIS app. As we explored above about the utterance, intent, and entities. We’ll be setting this ahead.
Step 14
Now, we will be taken to the Intents page. Click on Create.
Let’s name the Intent name as GetCityWeather.
Step 15
Now, let us go to the Entities and click on Add prebuilt entity.
Microsoft Azure and Cognitive Services already have a plethora of pre-built entities. Currently, we are building a weatherapp that can understand our text and help us identify weather of specific location – city or country. For this, we’ll be using geography V2 which is a prebuilt entity.
Search for geo in the search bar, and then select the geographyV2.
We can now see, the geographyV2 has been added.
Step 16
Next, we visit the Intents and add few of our input.
For now, let us add, “is it snowing in Kathmandu right now?”
You can see, Kathmandu has been underlined with geographyV2 tag below it. This is because LUIS has been able to identify Kathmandu as some type of entity we are trying to know about.
Let us add a few more examples to train the app. Now we go with, “how is the current weather in Palo Alto?”.
We can again see, palo alto has been underlined.
Step 17
Now let us train the model by clicking on Train. We’ll see, the process notification as we do so.
We can then see the Score. Here it is 0.959 and 0.956. This is basically the coefficient. More it is near to 1, it's better. This showcases that our experiment was highly successful and we’ve now built a model to understand the intent and entity to ask for weather. We can now use this model to know about weather in any other app.
Step 18
Let us Test it. We can see, the Top-scoring intent for GetCityWeather and geographyV2 identified kathmandu.
We can similarly, add more user inputs to help system be trained about more cities or countries.
Step 19
Now, let us click on Publish and publish our app. We’ll be notified as below.
Once published, we can obtain Endpoint URL with primary and secondary key which can be used in any of our applications to integrate this weatherapp output from LUIS.
Later, we can just add text to the end of the HTTP link to find out specific text search.
Step 20
Now, if we test out new text, “what is the weather like in russia?” now. See can obtain it in JSON format too. We can clearly see, the intent to understand about weather has been successful along with the geographyV2 able to identify the text russia as a country/region.
This showcases, how easy it is to build a conversation app with LUIS. We have been able to build an app that can understand texts. The power of Machine Learning and Artificial Intelligence has made it a reality for computer to understand our human language through Natural Language Processing.
In the next article, we’ll learn about the process to create a chatbot using Azure AI.
Conclusion
Thus, we learned about LUIS, what functionalities Azure AI supports and went through a hands-on process to create a conversation app in LUIS. We used Azure AI to setup the resources necessary and from the LUIS AI application, we built a weather app that can understand our text to return our weather of any city or country.