コード例 #1
0
        // </snippet_train>

        // <snippet_getkeys>
        // Get and display list of extracted keys for training data
        // provided to train the model
        private static async Task GetListOfExtractedKeys(
            IFormRecognizerClient formClient, Guid modelId)
        {
            if (modelId == Guid.Empty)
            {
                Console.WriteLine("\nInvalid model Id.");
                return;
            }

            try
            {
                KeysResult kr = await formClient.GetExtractedKeysAsync(modelId);

                var clusters = kr.Clusters;
                foreach (var kvp in clusters)
                {
                    Console.WriteLine("  Cluster: " + kvp.Key + "");
                    foreach (var v in kvp.Value)
                    {
                        Console.WriteLine("\t" + v);
                    }
                }
            }
            catch (ErrorResponseException e)
            {
                Console.WriteLine("Get list of extracted keys : " + e.Message);
            }
        }
コード例 #2
0
        private static IReadOnlyList <CustomFormSubmodel> ConvertFromUnlabeled(KeysResult keys)
        {
            var subModels = new List <CustomFormSubmodel>();

            foreach (var cluster in keys.Clusters)
            {
                var fieldMap = new Dictionary <string, CustomFormModelField>();
                for (int i = 0; i < cluster.Value.Count; i++)
                {
                    string fieldName  = "field-" + i;
                    string fieldLabel = cluster.Value[i];
                    fieldMap.Add(fieldName, new CustomFormModelField(fieldName, fieldLabel, default));
                }
                subModels.Add(new CustomFormSubmodel(
                                  $"form-{cluster.Key}",