Skip to content

Commit 40d6a3f

Browse files
authored
Merge pull request #49819 from diberry/0823-qs-intent-remaining-langs
intent - remaining languages - mvc/cfr
2 parents 8d92e8f + 24dca60 commit 40d6a3f

10 files changed

+217
-279
lines changed

articles/cognitive-services/LUIS/luis-get-started-go-get-intent.md

Lines changed: 53 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,87 @@
11
---
2-
title: Quickstart learning how to call a Language Understanding (LUIS) app using Go | Microsoft Docs
3-
description: In this quickstart, you learn to call a LUIS app using Go.
2+
title: Analyze natural language text in Language Understanding (LUIS) using GO - Azure Cognitive Services | Microsoft Docs
3+
description: In this quickstart, use an available public LUIS app to determine a user's intention from conversational text. Using GO, send the user's intention as text to the public app's HTTP prediction endpoint. At the endpoint, LUIS applies the public app's model to analyze the natural language text for meaning, determining overall intent and extracting data relevant to the app's subject domain.
44
services: cognitive-services
55
author: diberry
66
manager: cjgronlund
77
ms.service: cognitive-services
88
ms.component: language-understanding
99
ms.topic: quickstart
10-
ms.date: 06/27/2018
10+
ms.date: 08/23/2018
1111
ms.author: diberry
12-
#Customer intent: As a developer new to LUIS, I want to query the endpoint of a published model using Go.
12+
#Customer intent: As an API or REST developer new to the LUIS service, I want to query the LUIS endpoint of a published model using GO so that I can see the JSON prediction response.
1313
---
1414

1515
# Quickstart: Call a LUIS endpoint using Go
16-
In this quickstart, pass utterances to a LUIS endpoint and get intent and entities back.
1716

18-
<!-- green checkmark -->
19-
<!--
20-
> [!div class="checklist"]
21-
> * Create LUIS subscription and copy key value for later use
22-
> * View LUIS endpoint results from browser to public sample IoT app
23-
> * Create Visual Studio Go console app to make HTTPS call to LUIS endpoint
24-
-->
25-
26-
<!-- link to free account -->
27-
For this article, you need a free [LUIS](luis-reference-regions.md#luis-website) account in order to author your LUIS application.
17+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-intro-para.md)]
2818

2919
## Prerequisites
3020

31-
* [Go](https://golang.org/) installed.
32-
* Your existing LUIS [**application ID**](./luis-get-started-create-app.md). The application ID is shown in the application dashboard.
33-
34-
> [!NOTE]
35-
> The complete Go solution is available from the [**LUIS-Samples** Github repository](https://github.com/Microsoft/LUIS-Samples/blob/master/documentation-samples/endpoint-api-samples/go).
36-
37-
## Create LUIS endpoint key
38-
39-
1. You first need to create a [Language Understanding API account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) in the Azure portal. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
40-
41-
2. Log in to the Azure portal at https://portal.azure.com.
42-
43-
3. Follow the steps in [Creating Endpoint Keys using Azure](./luis-how-to-azure-subscription.md) to get a key.
44-
45-
4. Go back to the [LUIS](luis-reference-regions.md) website. Log in using your Azure account.
46-
47-
[![](media/luis-get-started-cs-get-intent/app-list.png "Screenshot of app list")](media/luis-get-started-cs-get-intent/app-list.png)
21+
* [Go](https://golang.org/) programming language
22+
* [Visual Studio Code](https://code.visualstudio.com/)
23+
* Public app ID: df67dcdb-c37d-46af-88e1-8b97951ca1c2
4824

49-
## Understand what LUIS returns
25+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-luis-repo-note.md)]
5026

51-
To understand what a LUIS app returns, you can paste the URL of a sample LUIS app into a browser window. The sample app is an [IoT app](https://azure.microsoft.com/services/cognitive-services/language-understanding-intelligent-service/) that detects whether the user wants to turn on or turn off lights.
27+
## Get LUIS key
5228

53-
1. The endpoint of the sample app is in this format: `https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2?subscription-key=<YOUR_API_KEY>&verbose=false&q=turn%20on%20the%20bedroom%20light` Copy the URL and substitute your endpoint key for the value of the `subscription-key` field.
29+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-get-key-para.md)]
5430

55-
2. Paste the URL into a browser window and press Enter. The browser displays a JSON result that indicates that LUIS detects the `HomeAutomation.TurnOn` intent and the `HomeAutomation.Room` entity with the value `bedroom`.
31+
## Analyze text with browser
5632

57-
![JSON result detects the intent TurnOn](./media/luis-get-started-cs-get-intent/turn-on-bedroom.png)
33+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-browser-para.md)]
5834

59-
3. Change the value of the `q=` parameter in the URL to `turn off the living room light`, and press Enter. The result now indicates that the LUIS detected the `HomeAutomation.TurnOff` intent and the `HomeAutomation.Room` entity with value `living room`.
60-
61-
![JSON result detects the intent TurnOff](./media/luis-get-started-cs-get-intent/turn-off-living-room.png)
62-
63-
## Consume a LUIS result using the Endpoint API with Go
35+
## Analyze text with Go
6436

6537
You can use Go to access the same results you saw in the browser window in the previous step.
6638

6739
1. Create a new file named `endpoint.go`. Add the following code:
6840

69-
[!code-go[Go code that calls a LUIS endpoint](~/samples-luis/documentation-samples/endpoint-api-samples/go/endpoint.go?range=29-81)]
41+
[!code-go[Go code that calls a LUIS endpoint](~/samples-luis/documentation-samples/quickstarts/analyze-text/go/endpoint.go?range=36-98)]
7042

7143
2. With a command prompt in the same directory as where you created the file, enter `go build endpoint.go` to compile the Go file. The command prompt does not return any information for a successful build.
7244

73-
3. Run the Go application from the command line by entering the following in the command prompt:
74-
75-
```CMD
76-
endpoint -appID df67dcdb-c37d-46af-88e1-8b97951ca1c2 -endpointKey <add-your-endpoint-key> -version 0.1 -region westus
77-
```
78-
79-
Replace `<add-your-endpoint-key>` with the value of your endpoint key.
80-
81-
The command prompt response is:
82-
83-
```CMD
84-
appID has value df67dcdb-c37d-46af-88e1-8b97951ca1c2
85-
endpointKey has value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
86-
region has value westus
87-
utterance has value turn on the bedroom light
88-
response
89-
{
90-
"query": "turn on the bedroom light",
91-
"topScoringIntent": {
92-
"intent": "HomeAutomation.TurnOn",
93-
"score": 0.809439957
94-
},
95-
"entities": [
96-
{
97-
"entity": "bedroom",
98-
"type": "HomeAutomation.Room",
99-
"startIndex": 12,
100-
"endIndex": 18,
101-
"score": 0.8065475
102-
}
103-
]
104-
}
105-
```
45+
3. Run the Go application from the command line by entering the following text in the command prompt:
46+
47+
```CMD
48+
go run endpoint.go -appID df67dcdb-c37d-46af-88e1-8b97951ca1c2 -endpointKey <add-your-key> -region westus
49+
```
50+
51+
Replace `<add-your-key>` with the value of your key.
52+
53+
The command prompt response is:
54+
55+
```CMD
56+
appID has value df67dcdb-c37d-46af-88e1-8b97951ca1c2
57+
endpointKey has value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
58+
region has value westus
59+
utterance has value turn on the bedroom light
60+
response
61+
{
62+
"query": "turn on the bedroom light",
63+
"topScoringIntent": {
64+
"intent": "HomeAutomation.TurnOn",
65+
"score": 0.809439957
66+
},
67+
"entities": [
68+
{
69+
"entity": "bedroom",
70+
"type": "HomeAutomation.Room",
71+
"startIndex": 12,
72+
"endIndex": 18,
73+
"score": 0.8065475
74+
}
75+
]
76+
}
77+
```
78+
79+
## LUIS keys
80+
81+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-key-usage-para.md)]
10682
10783
## Clean up resources
108-
The two resources created in this quickstart are the LUIS endpoint key and the Go project. Delete the LUIS endpoint key from the Azure portal. Close the Go file and remove it from the file system.
84+
Close the Go file and remove it from the file system.
10985
11086
## Next steps
11187
> [!div class="nextstepaction"]

articles/cognitive-services/LUIS/luis-get-started-java-get-intent.md

Lines changed: 26 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
2-
title: Quickstart learning how to call a Language Understanding (LUIS) app using Java | Microsoft Docs
3-
description: In this quickstart, you learn to call a LUIS app using Java.
4-
services: cognitive-services
2+
title: Analyze natural language text in Language Understanding (LUIS) using Java - Cognitive Services - Azure Cognitive Services | Microsoft Docs
3+
description: In this quickstart, use an available public LUIS app to determine a user's intention from conversational text. Using Java, send the user's intention as text to the public app's HTTP prediction endpoint. At the endpoint, LUIS applies the public app's model to analyze the natural language text for meaning, determining overall intent and extracting data relevant to the app's subject domain.
54
author: diberry
65
manager: cjgronlund
76
ms.service: cognitive-services
@@ -12,63 +11,52 @@ ms.author: diberry
1211
#Customer intent: As a developer new to LUIS, I want to query the endpoint of a published model using Java.
1312
---
1413

15-
# Quickstart: Call a LUIS endpoint using Java
16-
In this quickstart, pass utterances to a LUIS endpoint and get intent and entities back.
14+
# Quickstart: Analyze text using Java
1715

18-
<!-- green checkmark -->
19-
<!--
20-
> [!div class="checklist"]
21-
> * Create LUIS subscription and copy key value for later use
22-
> * View LUIS endpoint results from browser to public sample IoT app
23-
> * Create Visual Studio C# console app to make HTTPS call to LUIS endpoint
24-
-->
25-
26-
For this article, you need a free [LUIS](luis-reference-regions.md#luis-website) account in order to author your LUIS application.
16+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-intro-para.md)]
2717

2818
<a name="create-luis-subscription-key"></a>
29-
## Create LUIS endpoint key
30-
You need a Cognitive Services API key to make calls to the sample LUIS app used in this walkthrough.
3119

32-
To get an API key, follow these steps:
33-
1. You first need to create a [Cognitive Services API account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) in the Azure portal. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
20+
## Prerequisites
3421

35-
2. Log in to the Azure portal at https://portal.azure.com.
22+
* [JDK SE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (Java Development Kit, Standard Edition)
23+
* [Visual Studio Code](https://code.visualstudio.com/)
24+
* Public app ID: df67dcdb-c37d-46af-88e1-8b97951ca1c2
3625

37-
3. Follow the steps in [Creating Endpoint Keys using Azure](./luis-how-to-azure-subscription.md) to get a key.
3826

39-
4. Go back to the [LUIS](luis-reference-regions.md) website and log in using your Azure account.
27+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-luis-repo-note.md)]
4028

41-
[![](media/luis-get-started-java-get-intent/app-list.png "Screenshot of App list")](media/luis-get-started-java-get-intent/app-list.png)
29+
## Get LUIS key
4230

43-
## Understand what LUIS returns
31+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-get-key-para.md)]
4432

45-
To understand what a LUIS app returns, you can paste the URL of a sample LUIS app into a browser window. The sample app is an IoT app that detects whether the user wants to turn on or turn off lights.
33+
## Analyze text with browser
4634

47-
1. The endpoint of the sample app is in this format: `https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/df67dcdb-c37d-46af-88e1-8b97951ca1c2?subscription-key=<YOUR_API_KEY>&verbose=false&q=turn%20on%20the%20bedroom%20light` Copy the URL and substitute your subscription key for the value of the `subscription-key` field.
48-
2. Paste the URL into a browser window and press Enter. The browser displays a JSON result that indicates that LUIS detects the `HomeAutomation.TurnOn` intent and the `HomeAutomation.Room` entity with the value `bedroom`.
35+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-browser-para.md)]
4936

50-
![JSON result detects the intent TurnOn](./media/luis-get-started-java-get-intent/turn-on-bedroom.png)
51-
3. Change the value of the `q=` parameter in the URL to `turn off the living room light`, and press enter. The result now indicates that the LUIS detected the `HomeAutomation.TurnOff` intent and the `HomeAutomation.Room` entity with value `living room`.
37+
## Analyze text with Java
5238

53-
![JSON result detects the intent TurnOff](./media/luis-get-started-java-get-intent/turn-off-living-room.png)
39+
You can use Java to access the same results you saw in the browser window in the previous step.
5440

41+
1. Copy the following code to create a class in a file named `LuisGetRequest.java`:
5542

56-
## Consume a LUIS result using the Endpoint API with Java
43+
[!code-java[Console app code that calls a LUIS endpoint](~/samples-luis/documentation-samples/quickstarts/analyze-text/java/call-endpoint.java)]
5744

58-
You can use Java to access the same results you saw in the browser window in the previous step.
59-
1. Copy the following code to create a class in your IDE:
45+
2. Replace the value of the `YOUR-KEY` variable with your LUIS key.
6046

61-
[!code-java[Console app code that calls a LUIS endpoint](~/samples-luis/documentation-samples/endpoint-api-samples/java/call-endpoint.java)]
62-
2. Replace the value of the `SubscriptionKey` variable with your LUIS endpoint key.
47+
3. Compile the java program with `javac -cp ":lib/*" LuisGetRequest.java`.
6348

64-
3. In your IDE, add references to `httpclient` and `httpcore` libraries.
49+
4. Run the application with `java -cp ":lib/*" LuisGetRequest.java`. It displays the same JSON that you saw earlier in the browser window.
6550

66-
4. Run the console application. It displays the same JSON that you saw earlier in the browser window.
51+
![Console window displays JSON result from LUIS](./media/luis-get-started-java-get-intent/console-turn-on.png)
52+
53+
## LUIS keys
6754

68-
![Console window displays JSON result from LUIS](./media/luis-get-started-java-get-intent/console-turn-on.png)
55+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-key-usage-para.md)]
6956

7057
## Clean up resources
71-
The two resources created in this tutorial are the LUIS endpoint key and the C# project. Delete the LUIS endpoint key from the Azure portal. Close the Visual Studio project and remove the directory from the file system.
58+
59+
Delete the Java file.
7260

7361
## Next steps
7462
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)