Exemple #1
0
        public static string Build(Poem Poem, MatchOptions Options, OutputOptions OO)
        {
            if (Poem == null)
            {
                return("");
            }
            if (Poem.Text.Trim().Length == 0)
            {
                return("");
            }

            List <Rule> Rules = new List <Rule>();

            if (OO.Rules == null || OO.Rules.Count == 0)
            {
                if (Poem.Identifier == null)
                {
                    Rules.AddRange(Manager.Rules());
                }
                else
                {
                    Rule R2 = Manager.FetchRule(Poem.Identifier);
                    if (R2 == null)
                    {
                        Rules.AddRange(Manager.Rules());
                    }
                    else
                    {
                        Rules.Add(R2);
                    }
                }
            }
            else
            {
                Rules.AddRange(OO.Rules);
            }

            Probable Pr = Padyam.MostProbable2(Poem.Text, Options, Rules);

            if (Pr.MatchResult == null)
            {
                Debugger.Break();
            }
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;
            Padyam      P  = Pr.Padyam;

            return(Build(MR, R, P, OO));
        }