Пример #1
0
 /// <summary>
 /// Adds a batch of labeled example utterances to a version of the application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='appId'>
 /// The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID.
 /// </param>
 /// <param name='exampleLabelObjectArray'>
 /// Array of example utterances.
 /// </param>
 /// <param name='enableNestedChildren'>
 /// Toggles nested/flat format
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <BatchLabelExample> > BatchAsync(this IExamples operations, System.Guid appId, string versionId, IList <ExampleLabelObject> exampleLabelObjectArray, bool?enableNestedChildren = false, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BatchWithHttpMessagesAsync(appId, versionId, exampleLabelObjectArray, enableNestedChildren, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #2
0
 /// <summary>
 /// Deletes the labeled example utterances with the specified ID from a version
 /// of the application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='appId'>
 /// The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID.
 /// </param>
 /// <param name='exampleId'>
 /// The example ID.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <OperationStatus> DeleteAsync(this IExamples operations, System.Guid appId, string versionId, long exampleId, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.DeleteWithHttpMessagesAsync(appId, versionId, exampleId, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #3
0
 /// <summary>
 /// Adds a labeled example utterance in a version of the application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='appId'>
 /// The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID.
 /// </param>
 /// <param name='exampleLabelObject'>
 /// A labeled example utterance with the expected intent and entities.
 /// </param>
 /// <param name='enableNestedChildren'>
 /// Toggles nested/flat format
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <LabelExampleResponse> AddAsync(this IExamples operations, System.Guid appId, string versionId, ExampleLabelObject exampleLabelObject, bool?enableNestedChildren = false, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddWithHttpMessagesAsync(appId, versionId, exampleLabelObject, enableNestedChildren, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Adds a batch of labeled examples to the specified application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='azureRegion'>
 /// Supported Azure regions for Cognitive Services endpoints. Possible values
 /// include: 'westus', 'westeurope'
 /// </param>
 /// <param name='appId'>
 /// Format - guid. The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID of the task.
 /// </param>
 /// <param name='exampleLabelObjectArray'>
 /// A JSON array containing example labels.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <BatchLabelExample> > BatchAddLabelsAsync(this IExamples operations, AzureRegions azureRegion, string appId, string versionId, IList <ExampleLabelObject> exampleLabelObjectArray = default(IList <ExampleLabelObject>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BatchAddLabelsWithHttpMessagesAsync(azureRegion, appId, versionId, exampleLabelObjectArray, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #5
0
 /// <summary>
 /// Returns example utterances to be reviewed from a version of the
 /// application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='appId'>
 /// The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID.
 /// </param>
 /// <param name='skip'>
 /// The number of entries to skip. Default value is 0.
 /// </param>
 /// <param name='take'>
 /// The number of entries to return. Maximum page size is 500. Default is 100.
 /// </param>
 /// <param name='enableNestedChildren'>
 /// Toggles nested/flat format
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <LabeledUtterance> > ListAsync(this IExamples operations, System.Guid appId, string versionId, int?skip = 0, int?take = 100, bool?enableNestedChildren = false, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(appId, versionId, skip, take, enableNestedChildren, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Adds a labeled example to the application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='azureRegion'>
 /// Supported Azure regions for Cognitive Services endpoints. Possible values
 /// include: 'westus', 'westeurope'
 /// </param>
 /// <param name='appId'>
 /// Format - guid. The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID of the task.
 /// </param>
 /// <param name='exampleLabelObject'>
 /// A JSON object containing the example label.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <LabelExampleResponse> AddLabelAsync(this IExamples operations, AzureRegions azureRegion, string appId, string versionId, ExampleLabelObject exampleLabelObject = default(ExampleLabelObject), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddLabelWithHttpMessagesAsync(azureRegion, appId, versionId, exampleLabelObject, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Returns example utterances to be reviewed from a version of the
 /// application.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='azureRegion'>
 /// Supported Azure regions for Cognitive Services endpoints. Possible values
 /// include: 'westus', 'westeurope', 'southeastasia', 'eastus2',
 /// 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope',
 /// 'eastasia', 'australiaeast', 'brazilsouth', 'virginia'
 /// </param>
 /// <param name='azureCloud'>
 /// Supported Azure Clouds for Cognitive Services endpoints. Possible values
 /// include: 'com', 'us'
 /// </param>
 /// <param name='appId'>
 /// The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID.
 /// </param>
 /// <param name='skip'>
 /// The number of entries to skip. Default value is 0.
 /// </param>
 /// <param name='take'>
 /// The number of entries to return. Maximum page size is 500. Default is 100.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<IList<LabeledUtterance>> ListAsync(this IExamples operations, AzureRegions azureRegion, AzureClouds azureCloud, System.Guid appId, string versionId, int? skip = 0, int? take = 100, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(azureRegion, azureCloud, appId, versionId, skip, take, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
Пример #8
0
        private static async Task WriteExamples(IExamples examples)
        {
            var targetPath = examples.Path;

            if (!Directory.Exists(targetPath))
            {
                Console.WriteLine($"Createing directory {targetPath}");
                Directory.CreateDirectory(targetPath);
            }

            var messages = examples.Build();

            var markdownPath = Path.Combine(targetPath, "Examples.md");

            using (var fs = File.Open(markdownPath, FileMode.Create, FileAccess.Write)) {
                using (var sw = new StreamWriter(fs, Encoding.UTF8)) {
                    await sw.WriteLineAsync("| File | Json | Binary |");

                    await sw.WriteLineAsync("|------|------|--------|");

                    foreach (var kvp in messages)
                    {
                        var jsonPath = Path.Combine(targetPath, $"{kvp.Key}.json");
                        kvp.Value.WriteJson(jsonPath, true).Wait();

                        long jsonSize;
                        using (var ms = new MemoryStream()) {
                            kvp.Value.WriteJson(ms, false).Wait();
                            jsonSize = ms.Length;
                        }
                        Console.WriteLine($"Wrote {jsonPath}");

                        var binPath = Path.Combine(targetPath, $"{kvp.Key}.bin");
                        kvp.Value.WriteBinary(binPath);
                        var binSize = new FileInfo(binPath).Length;
                        Console.WriteLine($"Wrote {binPath}");

                        await sw.WriteLineAsync($"| {kvp.Key} | [{BytesConverter.ToReadableString(jsonSize)}]({jsonPath.Substring(DocsPath.Length + 1).Replace("\\", "/")} ':ignore') | [{BytesConverter.ToReadableString(binSize)}]({binPath.Substring(DocsPath.Length + 1).Replace("\\", "/")} ':ignore') |");
                    }
                }
            }

            Console.WriteLine($"Wrote {markdownPath}");
        }
 /// <summary>
 /// Deletes the label with the specified ID.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='azureRegion'>
 /// Supported Azure regions for Cognitive Services endpoints. Possible values
 /// include: 'westus', 'westeurope'
 /// </param>
 /// <param name='appId'>
 /// Format - guid. The application ID.
 /// </param>
 /// <param name='versionId'>
 /// The version ID of the task.
 /// </param>
 /// <param name='exampleId'>
 /// The example ID.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteExampleLabelsAsync(this IExamples operations, AzureRegions azureRegion, string appId, string versionId, int exampleId, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteExampleLabelsWithHttpMessagesAsync(azureRegion, appId, versionId, exampleId, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Пример #10
0
 public HomeController(IExamples iAllExamples) //, IDiplomas iAllDiplomas)
 {
     _allExamples = iAllExamples;
     //_allDiplomas = iAllDiplomas;
 }