Пример #1
0
        public void ValidateSchema(CustomTextSchema schema, CustomTextProjects projects, SelectedProjects selectedProjects)
        {
            var result = ValidateSchemaInternal(schema, projects, selectedProjects);

            if (result == false)
            {
                throw new Exception("Cognitive Search doesn't support spaces or special characters in entity names! please rename your entities and re-train your model");
            }
        }
Пример #2
0
        private bool ValidateSchemaInternal(CustomTextSchema schema, CustomTextProjects projects, SelectedProjects selectedProjects)
        {
            var result = true;

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                result &= ValidateEntityNames(schema);
            }

            return(result);
        }
        public static SelectedProjects LoadSelectedProjects(CustomTextProjects projects)
        {
            var ERP = IsValidProjectCredentials(projects.EntityRecognition);
            var SCP = IsValidProjectCredentials(projects.SingleClassification);
            var MCP = IsValidProjectCredentials(projects.MultiClassification);

            if (!ERP && !SCP && !MCP)
            {
                throw new Exception("Please Provide One or More Custom Text Projects!");
            }
            return(new SelectedProjects()
            {
                IsSelected_EntityRecognitionProject = ERP,
                IsSelected_SingleClassificationProject = SCP,
                IsSelected_MultiClassificationProject = MCP
            });
        }
        public async Task <CustomTextSchema> LoadCustomTextAppSchema(
            CustomTextResource customTextResource,
            CustomTextProjects customTextProjects,
            SelectedProjects selectedProjects)
        {
            var client = new CustomTextAuthoringClient(customTextResource.Endpoint, customTextResource.Key);
            var result = new CustomTextSchema();

            // load extractors
            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                var extractors = await LoadExtractors(client, customTextProjects.EntityRecognition.ProjectName);

                result.EntityNames = extractors.Select(e => e.Name).ToList();
            }

            // return result
            return(result);
        }