Skip to content

Commit 41c8471

Browse files
committed
java verified, php verified
1 parent 4f78e43 commit 41c8471

File tree

2 files changed

+28
-40
lines changed

2 files changed

+28
-40
lines changed

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 your IDE:
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. In your IDE, add references to `httpclient` and `httpcore` libraries. Compile the java program.
6348

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.
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"]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ You can use Python to access the same results you saw in the browser window in t
6060

6161
1. Copy one of the following code snippets:
6262

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)]
6464

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)]
6666

6767

6868
2. Replace the value of the `Ocp-Apim-Subscription-Key` field with your LUIS endpoint key.

0 commit comments

Comments
 (0)