From 4aaabeb69973baccf90b1bc7b7d2140ce7993694 Mon Sep 17 00:00:00 2001 From: v-geberr Date: Fri, 3 Nov 2017 13:18:44 -0700 Subject: [PATCH] added comments so mk can pull code sections --- .../node/add-utterances.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/documentation-samples/authoring-api-samples/node/add-utterances.js b/documentation-samples/authoring-api-samples/node/add-utterances.js index 1821592..30b51d3 100644 --- a/documentation-samples/authoring-api-samples/node/add-utterances.js +++ b/documentation-samples/authoring-api-samples/node/add-utterances.js @@ -13,10 +13,12 @@ // add-utterance -status // Checks the training status and writes status details to a file. +// var rp = require('request-promise'); var fse = require('fs-extra'); var path = require('path'); +// // To run this sample, change these constants. // Programmatic key, available in luis.ai under Account Settings @@ -30,10 +32,11 @@ const LUIS_versionId = "0.1"; // The contents of the file must be in this format described at: https://aka.ms/add-utterance-json-format const uploadFile = "./utterances.json" - +// var trainAfterAdd = false; var requestTrainingStatus = false; +// // Command line arguments: // -train to train based on the utterances in uploadFile // -status to get training status @@ -45,7 +48,7 @@ if (process.argv.length >= 3) { } } - +// /* upload configuration */ var configAddUtterance = { LUIS_subscriptionKey: LUIS_programmaticKey, @@ -55,7 +58,7 @@ var configAddUtterance = { uri: "https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/examples".replace("{appId}", LUIS_appId).replace("{versionId}", LUIS_versionId) }; - +// // Call add-utterance var addUtterance = async (config) => { @@ -87,7 +90,7 @@ var addUtterance = async (config) => { } } - +// /* training configuration */ var configTrain = { LUIS_subscriptionKey: LUIS_programmaticKey, @@ -96,7 +99,7 @@ var configTrain = { uri: "https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/train".replace("{appId}", LUIS_appId).replace("{versionId}", LUIS_versionId), method: 'POST', // POST to request training, GET to get training status }; - +// // Call train var train = async (config) => { @@ -129,7 +132,7 @@ var train = async (config) => { } - +// // Send JSON as the body of the POST request to the API var sendUtteranceToApi = async (options) => { try { @@ -148,7 +151,7 @@ var sendUtteranceToApi = async (options) => { } } - +//
if (trainAfterAdd) { // Add the utterance to the LUIS app and train addUtterance(configAddUtterance)