private static Skillset CreateTestOcrSkillset(int repeat, TextExtractionAlgorithm algorithm, string name = null, bool shouldDetectOrientation = false) { var skills = new List <Skill>(); var inputs = new List <InputFieldMappingEntry>() { new InputFieldMappingEntry { Name = "url", Source = "/document/url" }, new InputFieldMappingEntry { Name = "queryString", Source = "/document/queryString" } }; for (int i = 0; i < repeat; i++) { var outputs = new List <OutputFieldMappingEntry>() { new OutputFieldMappingEntry { Name = "text", TargetName = "mytext" + i } }; skills.Add(new OcrSkill(inputs, outputs, "Tested OCR skill" + i, RootPathString) { TextExtractionAlgorithm = algorithm, ShouldDetectOrientation = shouldDetectOrientation, DefaultLanguageCode = "en", Context = "/document", }); } return(new Skillset(name: name ?? SearchTestUtilities.GenerateName(), description: "Skillset for testing OCR", skills: skills)); }
internal static string ToSerializedValue(this TextExtractionAlgorithm value) { switch (value) { case TextExtractionAlgorithm.Printed: return("printed"); case TextExtractionAlgorithm.Handwritten: return("handwritten"); } return(null); }
private static Skillset CreateTestSkillsetOcrSentiment(OcrSkillLanguage ocrLanguageCode, SentimentSkillLanguage sentimentLanguageCode, TextExtractionAlgorithm algorithm) { var skills = new List <Skill>(); var inputs = new List <InputFieldMappingEntry>() { new InputFieldMappingEntry { Name = "url", Source = "/document/url" }, new InputFieldMappingEntry { Name = "queryString", Source = "/document/queryString" } }; var outputs = new List <OutputFieldMappingEntry>() { new OutputFieldMappingEntry { Name = "text", TargetName = "mytext" } }; skills.Add(new OcrSkill(inputs, outputs, "Tested OCR skill", RootPathString) { TextExtractionAlgorithm = algorithm, DefaultLanguageCode = ocrLanguageCode }); var inputs1 = new List <InputFieldMappingEntry>() { new InputFieldMappingEntry { Name = "text", Source = "/document/mytext" } }; var outputs1 = new List <OutputFieldMappingEntry>() { new OutputFieldMappingEntry { Name = "score", TargetName = "mySentiment" } }; skills.Add(new SentimentSkill(inputs1, outputs1, "Tested Sentiment skill", RootPathString) { DefaultLanguageCode = sentimentLanguageCode }); return(new Skillset("testskillset1", "Skillset for testing", skills)); }
public static string ToSerialString(this TextExtractionAlgorithm value) => value switch {