예제 #1
0
        protected override string PrettyPrintedExamples()
        {
            var formattedConstraints =
                UsedExamples.Select(SpecFileExampleFormat.FromExample);

            return(JsonConvert.SerializeObject(formattedConstraints, Formatting.Indented));
        }
예제 #2
0
            protected override string PrettyPrintedExamples()
            {
                var formattedConstraints =
                    UsedExamples.Select(constraint =>
                                        new Dictionary <string, string>
                {
                    ["Input"]  = constraint.InputMember.Value,
                    ["Output"] = constraint.OutputMember.Value
                });

                return(JsonConvert.SerializeObject(formattedConstraints, Formatting.Indented));
            }
예제 #3
0
            public override void Run()
            {
                if (!Directory.Exists(ReportDirPath))
                {
                    Directory.CreateDirectory(ReportDirPath);
                }
                Console.WriteLine($"Learning Extraction.Text sequence program for {SubBenchmarkName}");

                while (!Success && TryGetNextExample(out SequenceExample nextConstraint))
                {
                    var session = new SequenceSession();
                    UsedExamples.Add(nextConstraint);
                    session.Constraints.Add(UsedExamples);
                    Program = session.Learn();
                    Success = Program != null && AllExamples.All(e => Valid(e, Program));
                }
                RecordResult();
            }
예제 #4
0
 /// <summary>
 ///     Pretty print used examples.
 /// </summary>
 /// <returns>Pretty-printed string containing examples used during learning.</returns>
 protected virtual string PrettyPrintedExamples() =>
 string.Join(Environment.NewLine, UsedExamples.Select(c => c.ToString()));