Git Product home page Git Product logo

cognitive-services-luis-console-application's Introduction

services platforms author
cognitive-services, luis, language-understanding
dotnet
cahann

Cognitive Services: LUIS Console Application Sample

A simple console demostrating how to consume the LUIS Runtime SDK to predict user utterances.

Prerequisites

The minimum prerequisites to run this sample are:

  • The latest update of Visual Studio 2015 or 2017. You can download the community version here for free.
  • A LUIS.ai account where to upload the sample's LUIS model.

LUIS Application

The first step to using LUIS is to create or import an application. Go to the home page, www.luis.ai, and log in. After creating your LUIS account you'll be able to Import an Existing Application where can you can select a local copy of the LuisApp.json file an import it.

Import an Existing Application

If you want to test this sample, you have to import the pre-build LuisApp.json file to your LUIS account.

Once you imported the application you'll need to "train" the model (Training) before you can "Publish" the model in an HTTP endpoint. For more information, take a look at Publishing a Model.

Finally, edit the appsettings.json file and update the attribute placeholders with the values corresponding to your Subscription, Application and Azure Region where the application was deployed.

Where to find the Application ID and Subscription Key

You'll need these two values to configure the LuisDialog through the LuisModel attribute:

  1. Application ID

    You can find the App ID in the LUIS application's settings.

    App Settings

  2. Subscription Key and Azure Region

    Click on the Publish App link from the top of the LUIS application dashboard. Once your app is published, copy the Region and Key String from Starter_Key from the Endpoints table on the Publish App page.

    Programmatic API Key

Code Highlights

One of the key problems in human-computer interactions is the ability of the computer to understand what a person wants, and to find the pieces of information that are relevant to their intent. In the LUIS application, you will bundle together the intents and entities that are important to your task. Read more about Planning an Application in the LUIS Docs.

Once your model is set, you can invoke de LUIS Runtime API to analize user input and obtain its intent and possible entities.

From .NET you can use the Microsoft.Azure.CognitiveServices.Language.LUIS NuGet package. Once you have reference the library, you can start making call to the API.

using Microsoft.Azure.CognitiveServices.Language.LUIS;
using Microsoft.Azure.CognitiveServices.Language.LUIS.Models;

// Create client with SuscriptionKey and AzureRegion
ILuisRuntimeAPI client = new LuisRuntimeAPI(new ApiKeyServiceClientCredentials("[LUIS_SUBSCRIPTION_KEY]"))
{
    AzureRegion = AzureRegions.Westus
};

// Predict
LuisResult result = await client.Prediction.ResolveAsync("[LUIS_APPLICATION_ID]", "Text to Predict or User input");

The LuisResult object contains the possible detected intents and entities that could be extracted from the input.

Outcome

You will see the following when running the application:

Sample Outcome

More Information

To get more information about how to get started in Bot Builder for .NET and Conversations please review the following resources:

cognitive-services-luis-console-application's People

Contributors

microsoftopensource avatar davidlicig avatar msftgits avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.