public async Task Regex_ExtractEntityGroupsNamedCaptureNoList() { Regex r = new Regex(@"how (?<One>.*) (?<Two>.*)"); string input = "how 11111 22222"; Intent i = RegExpRecognizerMiddleware.Recognize(input, r, 1.0); Assert.IsNotNull(i, "Expected an Intent"); Assert.IsTrue(i.Entities.Count == 2, "Should match 2 groups"); Assert.IsTrue(i.Entities[0].ValueAs <string>() == "11111"); Assert.IsTrue(i.Entities[0].GroupName == "One"); Assert.IsTrue(i.Entities[1].ValueAs <string>() == "22222"); Assert.IsTrue(i.Entities[1].GroupName == "Two"); }
public async Task Regex_ExtractEntityGroupsNamedCaptureViaList() { Regex r = new Regex(@"how (.*) (.*)", RegexOptions.IgnoreCase); string input = "How 11111 22222"; Intent i = RegExpRecognizerMiddleware.Recognize(input, r, new List <string>() { "One", "Two" }, 1.0); Assert.IsNotNull(i, "Expected an Intent"); Assert.IsTrue(i.Entities.Count == 2, "Should match 2 groups"); Assert.IsTrue(i.Entities[0].ValueAs <string>() == "11111"); Assert.IsTrue(i.Entities[0].GroupName == "One"); Assert.IsTrue(i.Entities[1].ValueAs <string>() == "22222"); Assert.IsTrue(i.Entities[1].GroupName == "Two"); }