Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public static string Build(MatchResult MR, Rule R, Padyam P, OutputOptions OO)
        {
            StringBuilder sb = new StringBuilder();

            if (MR.Percentage != 100)
            {
                sb.Append("<div style=' margin-top:10px;'>");
                sb.Append("<div class='err10' style='clear:left;text-align:left;width:100%;' tile='" + R.Name + "'>" + (OO.UseFullName ? R.Name : R.ShortName));
                sb.Append(": <b style='color:red'>" + MR.Percentage.ToString("0") + "%</b>(" + MR.Score + "/" + MR.Total + ")");
                sb.AppendLine("</div>");

                sb.AppendLine("<div style='clear:left;float:left;width:50%;margin-right:10px;'>");

                sb.AppendLine("<div style='margin:10px; text-align:left;'>");

                sb.AppendLine("<div class='Err22'>");
                sb.AppendLine(P.Build2(MR));
                sb.AppendLine("</div>");

                sb.AppendLine("<div class='err' style='text-align:right;'>తప్పులు</div>");
                sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                sb.AppendLine("</div>");

                sb.AppendLine("</div>");

                sb.AppendLine("<div style='float:left;width:auto;margin-left:10px;'><div class='err'  style='text-align:right;'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");
                sb.AppendLine("</div>");
            }
            else
            {
                if (!OO.ErrorsOnly)
                {
                    sb.Append("<div style=' margin-top:10px;'>");
                    sb.AppendLine("<div class='err10' style='clear:left;text-align:left;width:100%;'>" + R.Name + "</div>");
                    sb.AppendLine("<div style='clear:left;float:left;margin-left:10px;'><div class='Err22'>");
                    sb.AppendLine(P.Build2(MR));
                    sb.AppendLine("</div></div>");
                    sb.AppendLine("</div>");
                }
            }

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public static string Build(Poem[] Poems, string title, string header, string footer, MatchOptions Options, OutputOptions OO)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<ol  class='ol'>");
            for (int i = 0; i < Poems.Length; i++)
            {
                Console.WriteLine("Processing Padyam: " + (i + 1));

                Poem poem = Poems[i];

                string x = Build(poem, Options, OO);
                if (x != "")
                {
                    sb.AppendLine("<li>");
                    sb.AppendLine(x);
                    sb.AppendLine("</li>");
                }
            }
            sb.AppendLine("</ol>");
            return(BuildFile(title, header, footer, sb.ToString(), OO.EmbedValue));
        }
Ejemplo n.º 4
0
 public static string Build(SatakamData S, MatchOptions Options, OutputOptions OO)
 {
     return(Build(S.Poems.ToArray(), S.Title, S.HeaderString, S.FooterString, Options, OO));
 }