You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/LUIS/luis-get-started-java-get-intent.md
+26-38Lines changed: 26 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
1
---
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.
5
4
author: diberry
6
5
manager: cjgronlund
7
6
ms.service: cognitive-services
@@ -12,63 +11,52 @@ ms.author: diberry
12
11
#Customer intent: As a developer new to LUIS, I want to query the endpoint of a published model using Java.
13
12
---
14
13
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
17
15
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)]
27
17
28
18
<aname="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.
31
19
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
34
21
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
36
25
37
-
3. Follow the steps in [Creating Endpoint Keys using Azure](./luis-how-to-azure-subscription.md) to get a key.
38
26
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)]
40
28
41
-
[](media/luis-get-started-java-get-intent/app-list.png)
29
+
## Get LUIS key
42
30
43
-
## Understand what LUIS returns
31
+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-get-key-para.md)]
44
32
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
46
34
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)]
49
36
50
-

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
52
38
53
-

39
+
You can use Java to access the same results you saw in the browser window in the previous step.
54
40
41
+
1. Copy the following code to create a class in your IDE:
55
42
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)]
57
44
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.
60
46
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. In your IDE, add references to `httpclient` and `httpcore` libraries. Compile the java program.
63
48
64
-
3. In your IDE, add references to `httpclient` and `httpcore` libraries.
49
+
4. Run the application. It displays the same JSON that you saw earlier in the browser window.
65
50
66
-
4. Run the console application. It displays the same JSON that you saw earlier in the browser window.
51
+

52
+
53
+
## LUIS keys
67
54
68
-

55
+
[!include[Use authoring key for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-key-usage-para.md)]
69
56
70
57
## 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.
Copy file name to clipboardExpand all lines: articles/cognitive-services/LUIS/luis-get-started-python-get-intent.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,9 +60,9 @@ You can use Python to access the same results you saw in the browser window in t
60
60
61
61
1. Copy one of the following code snippets:
62
62
63
-
[!code-python[Console app code that calls a LUIS endpoint for Python 2.7](~/samples-luis/documentation-samples/endpoint-api-samples/python/2.x/quickstart-call-endpoint-2-7.py)]
63
+
[!code-python[Console app code that calls a LUIS endpoint for Python 2.7](~/samples-luis/documentation-samples/quickstarts/analyze-text/python/2.x/quickstart-call-endpoint-2-7.py)]
64
64
65
-
[!code-python[Console app code that calls a LUIS endpoint for Python 3.6](~/samples-luis/documentation-samples/endpoint-api-samples/python/3.x/quickstart-call-endpoint-3-6.py)]
65
+
[!code-python[Console app code that calls a LUIS endpoint for Python 3.6](~/samples-luis/documentation-samples/quickstarts/analyze-text/python/3.x/quickstart-call-endpoint-3-6.py)]
66
66
67
67
68
68
2. Replace the value of the `Ocp-Apim-Subscription-Key` field with your LUIS endpoint key.
0 commit comments