Cognitive Services: Building Natural Language Analyzer with LUIS(Language Understanding Intelligent Service), using Prebuild Domains
Cognitive Services: Language Understanding Intelligent Service (LUIS)
LUIS is natural language analyze engine, to categorize and extract entities from colloquial sentence. You can build App (engine) easily setting up "Intents" (categories) and "Entities" on your own, or instantly using "Prebuild Domains" which are sets of commonly-used Intents and Entities.
Here is how to build your LUIS App using Prebuild Domains and access via API.
- Microsoft Account
- Need for LUIS account. (-> Create new Microsoft Account if you don’t have)
- LUIS Subscription Key
Access & create new LUIS App on Luis Portal
LUIS has portal (https://www.luis.ai/) , to create, configure and manage language analyze engines. Click [Sign in or Create Account], and sign in with a Microsoft account.
At My Apps page, click [New App] to create new LUIS app.
Type Name and select Culture (language: "English" this time) and click [Create].
Once new app created, page is navigated to Overview page.
Add Prebuilt Domain and Prebuilt Entity to your LUIS App
Click Prebuild domain at left column menu. Prebuilt Domains show up.
Look for "Weather" and click to add. Click [Yes] to proceed.
You can see what are included for Prebuilt Domain, clicking "Learn More" link.
Let's go and see what are added to your LUIS app, and add prebuilt entity too.
Click Entities at left column menu. There should be one entity named Weather.Location to extract location name from sentence. Click [prebuild entities] in Entities page menu, and add entity to extract date&time.
Select datetime and click [OK].
Now let's see what are in Intents. Click Intents at left column menu. You can see 2 intents, Weather.GetCondition and Weather.GetForecast. This Weather Prebuilt Domain app categorize sentences into 3, want to know conditions of weather (Weather.GetCondition), wants to know weather forecast (Weather.GetForecast), and others (none).
Click Weather.GetForecast on Intents page menu, and check utterances (typical sentences for study data). You can change labels view, and check what words are recognized as entities.
Train & Test your LUIS App
Let's get trained your LUIS app. Click Train&Test at left column menu. Click [Train Application] to train.
Once you trained app, there shows testing console. Type sentence and get result, Intents and Entities.
Publish & Access to your LUIS App
After you "publish" your app, you can access it from API. You need subscription key to publish.
Click Publish at left column menu. At Publish App page, click Add new key to your account to save your subscription key.
At My Keys page, click [Add a key], and paste your key to Key Value.
Back to Publish App page, assign key to your app at Endpoint Key selector. Click [Publish] to publish your app.
Once you published app, there shows Endpoint Url, and you can access to app using this URL, adding sentence after "q=" at last.
LUIS app returns result in JSON Format, showing intents and entities with scores.