Skip to content

Commit df88c4a

Browse files
authored
Merge pull request #49965 from diberry/0824-authoring-N-lang
qs authoring remaining languages
2 parents d066898 + fd1ca2d commit df88c4a

10 files changed

+401
-632
lines changed

articles/cognitive-services/LUIS/luis-get-started-cs-add-utterance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ Build the code in Visual Studio.
123123

124124
In the project's /bin/Debug directory, run the application from a command line.
125125

126-
````
126+
```CMD
127127
ConsoleApp\bin\Debug> ConsoleApp1.exe --add utterances.json --train --status
128-
````
128+
```
129129

130130
This command-line displays the results of calling the add utterances API.
131131

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

Lines changed: 121 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,66 @@
11
---
2-
title: Quickstart learning how to add utterances to a LUIS app using Go | Microsoft Docs
3-
description: In this quickstart, you learn to call a LUIS app using Go.
4-
services: cognitive-services
2+
title: Quickstart change model and train LUIS app using Go - Azure Cognitive Services | Microsoft Docs
3+
description: In this Go quickstart, add example utterances to a Home Automation app and train the app. Example utterances are conversational user text mapped to an intent. By providing example utterances for intents, you teach LUIS what kinds of user-supplied text belongs to which intent.
54
titleSuffix: Microsoft Cognitive Services
65
author: diberry
76
manager: cjgronlund
87
ms.service: cognitive-services
98
ms.component: language-understanding
109
ms.topic: quickstart
11-
ms.date: 07/17/2018
10+
ms.date: 08/24/2018
1211
ms.author: diberry
13-
#Customer intent: As a developer new to LUIS, I want to add an utterance to the LUIS app model using Go.
12+
#Customer intent: As an API or REST developer new to the LUIS service, I want to programmatically add an example utterance to an intent and train the model using Go.
1413
---
1514

16-
# Quickstart: Add utterances to a LUIS app using Go
17-
In this quickstart, write a program to add an utterance to an intent in an app, train the app, and get training status using the Authoring APIs with Go.
15+
# Quickstart: Change model using Go
1816

19-
<!-- green checkmark -->
20-
<!--
21-
> [!div class="checklist"]
22-
> * Create Visual Studio console project
23-
> * Add method to call LUIS API to add utterance and train app
24-
> * Add JSON file with example utterances for BookFlight intent
25-
> * Run console and see training status for utterances
26-
-->
17+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-endpoint-intro-para.md)]
2718

28-
For more information, see the technical documentation for the [add example utterance to intent](https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c08), [train](https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c45), and [training status](https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c46) APIs.
19+
## Prerequisites
2920

30-
For this article, you need a free [LUIS](luis-reference-regions.md#luis-website) account in order to author your LUIS application.
21+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-change-model-prereq.md)]
22+
* [Go](https://golang.org/) programming language installed.
23+
* [VSCode](https://code.visualstudio.com)
3124

32-
## Prerequisites
25+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-change-model-luis-repo-note.md)]
26+
27+
## Example utterances JSON file
28+
29+
[!include[Quickstart introduction for endpoint](../../../includes/cognitive-services-luis-qs-change-model-json-ex-utt.md)]
30+
31+
## Create quickstart code
32+
33+
1. Create `add-utterances.go` with VSCode.
34+
35+
2. Add dependencies.
3336

34-
* [Go](https://golang.org/) installed.
35-
* Your LUIS **[authoring key](luis-concept-keys.md#authoring-key)**. You can find this key under Account Settings in the [LUIS](luis-reference-regions.md) website.
36-
* Import [TravelAgent - Sample 1
37-
](https://github.com/Microsoft/LUIS-Samples/blob/master/documentation-samples/Examples-BookFlight/travel-agent-sample-01.json) app from Github repository. Get the new app ID from **Settings** page in LUIS website.
38-
* The **version ID** within the application that receives the utterances. The default ID is `0.1`.
39-
* Create a new file named `add-utterances.go` project in VSCode.
37+
[!code-go[Add dependencies.](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=2-10 "Add dependencies.")]
4038

41-
> [!NOTE]
42-
> The complete Go solution including an example `utterances.json` file are available from the [**LUIS-Samples** Github repository](https://github.com/Microsoft/LUIS-Samples/blob/master/documentation-samples/authoring-api-samples/go).
39+
3. Add generic HTTP request function, which includes passing authoring key in header.
4340

44-
## Add utterances and train using the Authoring API with Go
45-
You can add example utterances to an existing intent and train the app with Go. Create a new file named `add-utterances.go`. Add the following code:
41+
[!code-go[Add HTTP request function which includes passing authoring key in header. ](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=12-36 "Add HTTP request function, which includes passing authoring key in header. ")]
4642

47-
[!code-go[Go code that adds utterance and trains app](~/samples-luis/documentation-samples/authoring-api-samples/go/add-utterances.go?range=35-136)]
43+
4. Add example utterances from JSON file.
4844

49-
## Specify utterances to add
50-
Create and edit the file `utterances.json` to specify the **array of utterances** you want to add to the LUIS app. The intent and entities **must** already be in the LUIS app.
45+
[!code-go[Add example utterances from JSON file.](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=62-76 "Add example utterances from JSON file.")]
5146

52-
> [!NOTE]
53-
> The LUIS `TravelAgent - Sample 1` application with the intents and entities used in the `utterances.json` file must exist prior to running the code in `add-utterances.go`. The code in this article does not create the intents and entities. It only adds the utterances for existing intents and entities.
47+
5. Request training. Uses a helper function to set the VERB for the same route as training status.
5448

55-
The `text` field contains the text of the utterance. The `intentName` field must correspond to the name of an intent in the LUIS app. The `entityLabels` field is required. If you don't want to label any entities, provide an empty list as shown in the following example:
49+
[!code-go[Request training. ](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=77-86 "Request training. ")]
5650

57-
If the entityLabels list is not empty, the `startCharIndex` and `endCharIndex` need to mark the entity referred to in the `entityName` field. Both indexes are zero-based counts meaning 6 in the top example refers to the "S" of Seattle and not the space before the capital S.
51+
6. Request training status. Uses a helper function to set the VERB for the same route as request training.
5852

59-
```JSON
60-
[
61-
{
62-
"text": "go lang 1",
63-
"intentName": "None",
64-
"entityLabels": []
65-
}
66-
,
67-
{
68-
"text": "go lang 2",
69-
"intentName": "None",
70-
"entityLabels": []
71-
}
72-
]
73-
```
53+
[!code-go[Request training status. ](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=87-90 "Request training status. ")]
54+
55+
7. Add main function to handle command-line parsing.
56+
57+
[!code-go[Add main function to handle command line parsing. ](~/samples-luis/documentation-samples/quickstarts/change-model/go/add-utterances.go?range=38-60 "Add main function to handle command-line parsing.")]
7458

7559
## Add an utterance from the command line, train, and get status
76-
Run the Go code from a command prompt to add an utterance, train the app, and get the training status.
7760

7861
1. From a command prompt in the directory where you created the Go file, enter `go build add-utterances.go` to compile the Go file. The command prompt does not return any information for a successful build.
7962

80-
3. Run the Go application from the command line by entering the following in the command prompt:
63+
2. Run the Go application from the command line by entering the following text in the command prompt:
8164

8265
```CMD
8366
add-utterances -appID <your-app-id> -authoringKey <add-your-authoring-key> -version <your-version-id> -region westus -utteranceFile utterances.json
@@ -103,22 +86,100 @@ Run the Go code from a command prompt to add an utterance, train the app, and ge
10386
"entityLabels": []
10487
}
10588
]
106-
201
107-
[{"value":{"ExampleId":77783998,"UtteranceText":"go lang 1"},"hasError":false},{"value":{"ExampleId":77783999,"UtteranceText":"go lang 2"},"hasError":false}]
89+
201
90+
[
91+
{
92+
"value": {
93+
"ExampleId": 77783998,
94+
"UtteranceText": "go lang 1"
95+
},
96+
"hasError": false
97+
},
98+
{
99+
"value": {
100+
"ExampleId": 77783999,
101+
"UtteranceText": "go lang 2"
102+
},
103+
"hasError": false
104+
}
105+
]
108106
training selected
109-
202
107+
202
110108
{"statusId":9,"status":"Queued"}
111109
training status selected
112-
200
113-
[{"modelId":"c52d6509-9261-459e-90bc-b3c872ee4a4b","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"5119cbe8-97a1-4c1f-85e6-6449f3a38d77","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"01e6b6bc-9872-47f9-8a52-da510cddfafe","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"33b409b2-32b0-4b0c-9e91-31c6cfaf93fb","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"1fb210be-2a19-496d-bb72-e0c2dd35cbc1","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"3d098beb-a1aa-423f-a0ae-ce08ced216d6","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"cce854f8-8f8f-4ed9-a7df-44dfea562f62","details":{"statusId":3,"status":"InProgress","exampleCount":24}},{"modelId":"4d97bf0d-5213-4502-9712-2d6e77c96045","details":{"statusId":3,"status":"InProgress","exampleCount":24}}]
110+
200
111+
[
112+
{
113+
"modelId": "c52d6509-9261-459e-90bc-b3c872ee4a4b",
114+
"details": {
115+
"statusId": 3,
116+
"status": "InProgress",
117+
"exampleCount": 24
118+
}
119+
},
120+
{
121+
"modelId": "5119cbe8-97a1-4c1f-85e6-6449f3a38d77",
122+
"details": {
123+
"statusId": 3,
124+
"status": "InProgress",
125+
"exampleCount": 24
126+
}
127+
},
128+
{
129+
"modelId": "01e6b6bc-9872-47f9-8a52-da510cddfafe",
130+
"details": {
131+
"statusId": 3,
132+
"status": "InProgress",
133+
"exampleCount": 24
134+
}
135+
},
136+
{
137+
"modelId": "33b409b2-32b0-4b0c-9e91-31c6cfaf93fb",
138+
"details": {
139+
"statusId": 3,
140+
"status": "InProgress",
141+
"exampleCount": 24
142+
}
143+
},
144+
{
145+
"modelId": "1fb210be-2a19-496d-bb72-e0c2dd35cbc1",
146+
"details": {
147+
"statusId": 3,
148+
"status": "InProgress",
149+
"exampleCount": 24
150+
}
151+
},
152+
{
153+
"modelId": "3d098beb-a1aa-423f-a0ae-ce08ced216d6",
154+
"details": {
155+
"statusId": 3,
156+
"status": "InProgress",
157+
"exampleCount": 24
158+
}
159+
},
160+
{
161+
"modelId": "cce854f8-8f8f-4ed9-a7df-44dfea562f62",
162+
"details": {
163+
"statusId": 3,
164+
"status": "InProgress",
165+
"exampleCount": 24
166+
}
167+
},
168+
{
169+
"modelId": "4d97bf0d-5213-4502-9712-2d6e77c96045",
170+
"details": {
171+
"statusId": 3,
172+
"status": "InProgress",
173+
"exampleCount": 24
174+
}
175+
}
176+
]
114177
```
115178
116179
This response includes the HTTP status code for each of the three HTTP calls as well as any JSON response returned in the body of the response.
117180
118-
You can verify the example utterances were added by refreshing the LUIS website for the **None** intent.
119-
120181
## Clean up resources
121-
When you are done with the quickstart, remove the files created in this quickstart and the LUIS application.
182+
When you are done with the quickstart, remove all the files created in this quickstart.
122183
123184
## Next steps
124185
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)