Example #1
0
        public static string Scores(string s, MatchOptions Options)
        {
            GanaVibhajana G           = new GanaVibhajana(s, Options.Language);
            bool          includeRare = Options.IncludeRare;
            int           min         = G.Min;
            int           max         = G.Max;

            includeRare = true;

            List <Rule> Rules = Options.QuickMatch ? RuleHelper.GetAllRules2(min, max, G.PreLines) : RuleHelper.GetAllRules(includeRare);

            List <MatchResult> L = new List <MatchResult>();

            foreach (Rule R in Rules)
            {
                Padyam P = new Padyam();
                P.MatchYati       = Options.MatchYati;
                P.MatchPrasa      = Options.MatchPrasa;
                P.AllowSantiPrasa = Options.AllowSantiPrasa;
                P.SandiMatch      = Options.ExperimenatalSandhi;

                MatchResult MR = P.Match(s, R);
                L.Add(MR);
                P = null;
            }

            string s2 = BuildAllScores(L);

            {
                L = null;
            }
            return(s2);
        }
Example #2
0
        public static string Build(string padyam, string ruleId, out string name, out int percentage)
        {
            percentage = 0;
            name       = "";
            Rule R = Manager.FetchRule(ruleId.Trim());

            if (R == null)
            {
                return("");
            }

            Padyam P = new Padyam();

            P.MatchYati       = MatchOptions.QucikMatchSettings.MatchYati;
            P.MatchPrasa      = MatchOptions.QucikMatchSettings.MatchPrasa;
            P.AllowSantiPrasa = MatchOptions.QucikMatchSettings.AllowSantiPrasa;
            P.SandiMatch      = MatchOptions.QucikMatchSettings.ExperimenatalSandhi;


            MatchResult MR = P.Match(padyam, R);

            percentage = MR.Percentage;
            name       = R.ShortName;
            if (MR.Total == 0)
            {
                return("");
            }

            return(P.Build2(MR));
        }
Example #3
0
        public static string TryMatch2(string s, Rule R, MatchOptions2 Options)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return("");
            }

            MatchOptions Options2 = Worker.GetOptions(Options);

            Padyam P = new Padyam();

            P.MatchYati       = Options2.MatchYati;
            P.MatchPrasa      = Options2.MatchPrasa;
            P.AllowSantiPrasa = Options2.AllowSantiPrasa;
            P.SandiMatch      = Options2.ExperimenatalSandhi;


            MatchResult MR = P.Match(s, R);

            if (MR.Total == 0)
            {
                return("");
            }
            return(BuildResult(R, P, MR, null, Options == null ? true : Options.ShowGV));
        }
Example #4
0
        public static string BuildResult(Rule R, Padyam P, MatchResult MR, List <MatchResult> Candidates, bool showGV)
        {
            bool handleProse = (Candidates != null);

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<div class='padyam'>");
            sb.AppendLine("<div class='chandassu'  title='" + R.Name + "'>" + R.ShortName + "</div>");
            sb.AppendLine("<div class='poem'>");
            sb.AppendLine(P.Build2(MR));
            sb.AppendLine("</div>");
            if (showGV)
            {
                sb.Append("<div class='open'>[O]</div>");
            }
            sb.AppendLine("</div>");

            if (showGV)
            {
                sb.Append("<div class='ganaVibhajana'>");
                sb.AppendLine(BuildResult4(R, P, MR, Candidates));
                sb.AppendLine("</div>");
            }


            return((string)Script.Literal("sb.toString2()", null));
        }
Example #5
0
        public static string BuildResult2(Probable Pr)
        {
            if (Pr == null)
            {
                return("");
            }

            Padyam      P  = Pr.Padyam;
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;

            if (MR.Total == 0)
            {
                return("");
            }
            string s2 = BuildResult(R, P, MR, Pr.Candiates);

            {
                P  = null;
                MR = null;
                R  = null;
            }

            return(s2);
        }
Example #6
0
        private Poem Match2(string p)
        {
            Poem S = new Poem( );

            Probable Pr = Padyam.MostProbable(p, new MatchOptions( ));
            Padyam   P  = Pr.Padyam;

            P.MatchYati       = true;
            P.MatchPrasa      = true;
            P.AllowSantiPrasa = true;
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;

            S.Calculated = R.ShortName;
            S.HasMatach  = MR.IsMatched;
            S.Percentage = MR.Percentage.ToString( );
            S.Remarks    = MR.ShowErrors(OutputFormat.Text);

            string s = P.Build2(Pr.MatchResult);

            S.MarkingText = s;

            S.Yatis = ExtractYati(s);


            return(S);
        }
Example #7
0
        private static string EvaluateAllRulesInternal(string title, string auth)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("<ol  class='ol'>");

            int cnt  = 1;
            int cnt2 = 1;

            foreach (Rule R in RuleHelper.GetAllRules(true))
            {
                Console.WriteLine((cnt++) + ". " + R.Identifier);

                sb.AppendLine("<ol  class='ol'>");
                foreach (string s in R.Examples)
                {
                    cnt2++;

                    sb.AppendLine("<li>");
                    Padyam P = new Padyam();
                    P.MatchYati  = false;
                    P.MatchPrasa = true;

                    MatchResult MR = P.Match(s, R);
                    sb.Append(Build(MR, R, P));
                    sb.AppendLine("<li>");
                }

                sb.AppendLine("</ol>");
            }
            Console.WriteLine("Total Poems evaluated: " + cnt2);
            return(BuildFile(title, title, "", sb.ToString(), null));
        }
Example #8
0
        private static string TryMatch3(string s, Rule R)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return("");
            }

            Padyam       P       = new Padyam();
            MatchOptions Options = MatchOptions.TradtionalMatchSettings;

            P.MatchYati       = Options.MatchYati;
            P.MatchPrasa      = Options.MatchPrasa;
            P.AllowSantiPrasa = Options.AllowSantiPrasa;
            P.SandiMatch      = Options.ExperimenatalSandhi;

            MatchResult MR = P.Match(s, R);

            if (MR.Total == 0)
            {
                return("");
            }

            //string sb="";
            //sb =sb+ "<div style='float:left;width:40%;margin-left:10px;'><div class='err'>" + R.ShortName + "</div><div class='Err22'>";
            //sb =sb+P.Build2 ( MR ) ;
            //sb =sb+"</div></div>" ;
            //return sb;
            return(P.Build2(MR));
        }
Example #9
0
        private static bool Match(string p1)
        {
            Probable    Pr = Padyam.MostProbable(p1);
            Padyam      P  = Pr.Padyam;
            MatchResult MR = Pr.MatchResult;

            //Rule R=Pr.Rule;
            return(MR.IsMatched);
        }
Example #10
0
	private void MostProbable()
	{
		string p = @"పలికెడిది భాగవత మఁట, 
పలికించెడివాడు రామభద్రుం డఁట, నేఁ
బలికిన భవహర మగునఁట, 
పలికెద, వేఱొండు గాథ బలుకఁగ నేలా?";
		Probable Pr = Padyam.MostProbable(p, MatchOptions.QucikMatchSettings);
		MatchResult MR = Pr.MatchResult;
		Padyam P = Pr.Padyam;
	}
Example #11
0
        public static Probable Determine(string s, MatchOptions Options)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return(null);
            }
            Probable Pr = Padyam.MostProbable(s, Options);

            return(Pr);
        }
Example #12
0
        public static string Build(string s, string number, string type)
        {
            Probable Pr = Padyam.MostProbable(s, MatchOptions.QucikMatchSettings);

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

            return(Build(MR, R, P, number, type));
        }
Example #13
0
        private void Identifier(string s)
        {
            MatchOptions Options = MatchOptions.QucikMatchSettings;

            Options.Language   = RuleLanguage.Kannada;
            Options.MatchYati  = false;
            Options.MatchPrasa = true;


            Probable    Pr = Padyam.MostProbable(s, Options);
            MatchResult MR = Pr.MatchResult;

            Console.Write(MR.Percentage);
        }
Example #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string s = new MachinePoem( ).Build("nadeepraghOshamu");
        Rule   R = new nadeepraghOshamu( );

        Padyam P = new Padyam( );

        P.MatchYati  = true;
        P.MatchPrasa = true;
        MatchResult MR = P.Match(s, R);

        result.InnerHtml = MR.ShowErrors(OutputFormat.HTML);
        ;
    }
Example #15
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));
        }
Example #16
0
        private void Matcher(string s)
        {
            Rule R = new karibRMhitamu();

            R.Language = RuleLanguage.Kannada;

            Padyam P = new Padyam();

            P.MatchPrasa = true;
            P.MatchYati  = false;

            MatchResult MR = P.Match(s, R);

            Console.Write(MR.Percentage);
        }
Example #17
0
        public static string BuildResult4(Rule R, Padyam P, MatchResult MR, List <MatchResult> Candidates)
        {
            StringBuilder sb = new StringBuilder();

            if (MR.Percentage != 100)
            {
                sb.AppendLine("<div class='err' style='text-align:center;width:100%;'>" + R.ShortName);
                sb.AppendLine(": <b class='percentage'>" + Number.ParseFloat(MR.Percentage.ToString()).ToFixed() + "%</b>(" + MR.Score + "/" + MR.Total + ")");
                sb.AppendLine("</div>");
            }
            else
            {
                sb.AppendLine("<div class='err Green' style='text-align:center;width:100%;'>");
                sb.AppendLine(R.ShortName);
                sb.AppendLine("</div>");
            }

            if (!R.InfiniteLength)
            {
                sb.AppendLine("<div style='float:left;width:40%;margin-left:10px;'><div class='err'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");

                if (MR.Percentage != 100)
                {
                    sb.AppendLine("<div style='float:left;width:50%;margin-right:10px;'><div class='err' style='text-align:right;'>దోషాలు</div>");
                    sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                    sb.AppendLine("</div>");
                }
            }
            else
            {
                if (MR.Percentage != 100)
                {
                    sb.AppendLine("<div style='float:left;width:50%;margin-right:10px;'><div class='err' style='text-align:right;'>దోషాలు</div>");
                    sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                    sb.AppendLine("</div>");
                }

                sb.AppendLine("<div style='float:left;width:40%;margin-left:10px;'><div class='err'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");
            }
            return((string)Script.Literal("sb.toString2()", null));
        }
Example #18
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());
        }
Example #19
0
        private static Stats Match2(string p)
        {
            Stats S = new Stats( );

            Probable    Pr = Padyam.MostProbable(p);
            Padyam      P  = Pr.Padyam;
            MatchResult MR = Pr.MatchResult;
            Rule        R  = Pr.Rule;


            S.Poem       = p;
            S.Calculated = R.Name;
            S.HasMatach  = MR.IsMatched;
            S.Percentage = MR.Percentage.ToString( );
            S.Remarks    = MR.ShowErrors(OutputFormat.Text);

            return(S);
        }
Example #20
0
        public static string Build2(string s, string number, string type, string skanda, string ghatta, ref int score)
        {
            Probable Pr = Padyam.MostProbable(s, MatchOptions.TradtionalMatchSettings);

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

            if (Pr.MatchResult.Percentage != 100)
            {
                score = 1;
            }
            score = 0;
            return(Build2(MR, R, P, s, number, type, skanda, ghatta));
        }
Example #21
0
        public static string Build2(MatchResult MR, Rule R, Padyam P, string lines, string number, string type, string skanda, string ghatta)
        {
            string x = P.Build2(MR);

            x = x.Replace("<b><u>", "<B><U><Font html:Color=\"#0000FF\">");
            x = x.Replace("</u></b>", "</Font></U></B>");
            string y = x.Replace("<b>", "<B><Font html:Color=\"#FF0000\">").Replace("<u>", "<U><Font html:Color=\"#0000FF\">").Replace("</b>", "</Font></B>").Replace("</u>", "</Font></U>").Replace("<br />", "&#10;");

            string        e  = MR.ShowErrors(OutputFormat.Text).Replace("\n", "&#10;");
            StringBuilder sb = new StringBuilder( );

            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + skanda + "</Data></Cell>");
            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + ghatta + "</Data></Cell>");
            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + number + "</Data></Cell>");
            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + type + "</Data></Cell>");
            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + R.ShortName + "</Data></Cell>");
            sb.AppendLine("<Cell><Data ss:Type=\"String\">" + MR.Percentage.ToString("0") + "</Data></Cell>");
            sb.AppendLine("<Cell ss:StyleID=\"s62\"><ss:Data ss:Type=\"String\"   xmlns=\"http://www.w3.org/TR/REC-html40\">" + y + "</ss:Data></Cell>");
            sb.AppendLine("<Cell ss:StyleID=\"s62\"><ss:Data ss:Type=\"String\"   xmlns=\"http://www.w3.org/TR/REC-html40\">" + e + "</ss:Data></Cell>");
            return(sb.ToString( ));
        }
Example #22
0
        public static string TryMatch2(string s, Rule R, MatchOptions Options)
        {
            if (s == null || s.Trim().Length == 0)
            {
                return("");
            }

            Padyam P = new Padyam();

            P.MatchYati       = Options.MatchYati;
            P.MatchPrasa      = Options.MatchPrasa;
            P.AllowSantiPrasa = Options.AllowSantiPrasa;
            P.SandiMatch      = Options.ExperimenatalSandhi;

            MatchResult MR = P.Match(s, R);

            if (MR.Total == 0)
            {
                return("");
            }
            return(BuildResult(R, P, MR, null));
        }
Example #23
0
        public static List <int> CalcMatras(string padyam)
        {
            Rule   R = new AnnamayaChandam();
            Padyam P = new Padyam();

            P.MatchYati       = false;
            P.MatchPrasa      = false;
            P.AllowSantiPrasa = false;
            P.SandiMatch      = false;
            MatchResult MR = P.Match(padyam, R);


            List <int> Matras = new List <int>();

            foreach (Errors E in MR.Errors)
            {
                if (E.Mismatch == Mismatch.Weight && E.Actual != "0")
                {
                    Matras.Add(Convert.ToInt32(E.Actual));
                }
            }
            return(Matras);
        }
Example #24
0
        public static string Build(MatchResult MR, Rule R, Padyam P, string number, string type)
        {
            StringBuilder sb = new StringBuilder( );

            sb.Append("<div style=' margin-top:10px;'>");
            if (MR.Percentage != 100)
            {
                sb.Append("<div class='err10' style='clear:left;text-align:left;width:100%;'>" + number + ".  " + R.ShortName);
                sb.AppendLine("-<i>" + type + "</i>");
                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:40%;margin-left:10px;'><div class='err'  style='text-align:right;'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");
            }
            else
            {
                sb.AppendLine("<div class='err10' style='clear:left;text-align:left;width:100%;'>" + number + ".  " + R.ShortName + "</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( ));
        }
Example #25
0
        public static string Build(MatchResult MR, Rule R, Padyam P)
        {
            StringBuilder sb = new StringBuilder();


            {
                sb.Append("<h2 style='color:blue; text-align:left; width:100%;'>" + R.Name);
                if (MR.Percentage != 100)
                {
                    sb.Append(": <b style='color:red'>" + MR.Percentage.ToString("0") + "<span class='symbol'>%</span></b>(" + MR.Score + "/" + MR.Total + ")");
                }
                sb.AppendLine("</h2>");
                sb.AppendLine("<br/>");
                sb.AppendLine("<p style='width:100%; text-align:left;border:1px solid Blue; border-left:4px solid #EEEEEE; '>");
                sb.AppendLine(P.Build2(MR));
                sb.AppendLine("</p>");
                sb.AppendLine("<br/>");

                sb.AppendLine("<br/>");
                sb.AppendLine("<h2 style='color:blue; text-align:center; width:100%;'>గణ విభజన</h2>");
                sb.AppendLine("<br/>");
                sb.AppendLine(P.Build(MR));


                if (MR.Percentage != 100)
                {
                    sb.AppendLine("<br/>");
                    sb.AppendLine("<h2 style='color:blue; text-align:center; width:100%;'>దోషాలు</h2>");
                    sb.AppendLine("<br/>");
                    sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                }
            }


            return(sb.ToString());
        }
Example #26
0
        public static string BuildResult(Rule R, Padyam P, MatchResult MR, List <MatchResult> Candidates)
        {
            StringBuilder sb = new StringBuilder();

            if (MR.Percentage != 100)
            {
                sb.AppendLine("<div class='err' style='text-align:center;width:100%;'>" + R.ShortName);
                sb.AppendLine(": <b style='color:red'>" + MR.Percentage.ToString() + "%</b>(" + MR.Score + "/" + MR.Total + ")");
                sb.AppendLine("</div>");
            }
            else
            {
                sb.AppendLine("<div class='err Green' style='text-align:center;width:100%;'>" + R.ShortName);
                sb.AppendLine("</div>");
            }
            if (MR.Percentage != 100)
            {
                if (!R.InfiniteLength)
                {
                    sb.AppendLine("<div style='float:left;width:40%;margin-left:10px;'><div class='err'>గణ విభజన</div>");
                    sb.AppendLine(P.Build(MR));
                    sb.AppendLine("</div>");

                    sb.AppendLine("<div style='float:left;width:50%;margin-right:10px;'><div class='err' style='text-align:right;'>దోషాలు</div>");
                    sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                    sb.AppendLine("</div>");
                }
                else
                {
                    sb.AppendLine("<div style='float:left;width:50%;margin-right:10px;'><div class='err' style='text-align:right;'>దోషాలు</div>");
                    sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                    sb.AppendLine("</div>");

                    sb.AppendLine("<div style='float:left;width:40%;margin-left:10px;'><div class='err'>గణ విభజన</div>");
                    sb.AppendLine(P.Build(MR));
                    sb.AppendLine("</div>");
                }
            }
            else
            {
                try
                {
                    sb.AppendLine("<div style='float:left;width:40%;margin-left:10px;'><div class='err'>" + R.ShortName + "</div><div class='Err22'>");
                    sb.AppendLine(P.Build2(MR));
                    sb.AppendLine("</div></div>");
                }
                catch
                {
                }

                sb.AppendLine("<div style='float:left;width:58%;margin-right:10px; padding-left:5px;'><div class='err'  style='text-align:right;'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");
            }

            if (Candidates != null && MR.Percentage != 100 && Candidates.Count > 1)
            {
                sb.AppendLine("<div style='clear:left; margin-top:10px;'>");
                sb.AppendLine("<div class='err'>సమీప ఫలితాలు</div>");
                sb.AppendLine("<ol>");

                for (int i = 0; i < Candidates.Count; i++)
                {
                    if (i > 5 || i == 0)
                    {
                        continue;
                    }
                    MatchResult _MR = Candidates[i];
                    sb.AppendLine("<li  id='candiate_" + i + "' data='" + _MR.Rule.Identifier + "'>" + _MR.Rule.Name);
                    sb.AppendLine(": <b style='color:red'>" + _MR.Percentage.ToString() + "%</b>");
                    sb.AppendLine("</li>");
                }
                sb.AppendLine("</ol>");

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

            return(sb.ToString());
        }
Example #27
0
 private static string Build(MatchResult MR, Rule R, Padyam P)
 {
     return(Build(MR, R, P, new OutputOptions {
         ErrorsOnly = false, UseFullName = false
     }));
 }
Example #28
0
        public static string BuildResult(Rule R, Padyam P, MatchResult MR, List <MatchResult> Candidates)
        {
            bool          handleProse = (Candidates != null);
            StringBuilder sb          = new StringBuilder();

            if (MR.Percentage != 100)
            {
                if (MR.Percentage < 50 && handleProse)
                {
                }
                else
                {
                    sb.AppendLine("<div class='err w100 center'>" + R.Name);
                    sb.AppendLine(": <b class='red'>" + Number.ParseFloat(MR.Percentage.ToString()).ToFixed() + "%</b>(" + MR.Score + "/" + MR.Total + ")");
                    sb.AppendLine("</div>");
                }
            }
            else
            {
                sb.AppendLine("<div class='err Green  w100 center'>" + R.Name);
                sb.AppendLine("</div>");
            }

            if (MR.Percentage != 100)
            {
                if (MR.Percentage < 50 && handleProse)
                {
                    sb.AppendLine("<div class='vachanam'>" + "<div class='err'>కవిత లేదా పాట లేదా వచనము లేదా గద్యము లేదా మరేదైనా ఛందోప్రక్రియ</div>" + "<div class='Err22'>");
                    sb.AppendLine(P.Build3());
                    sb.AppendLine("</div></div>");
                }
                else
                {
                    if (!R.InfiniteLength)
                    {
                        sb.AppendLine("<div class='build'><div class='err'>గణ విభజన</div>");
                        sb.AppendLine(P.Build(MR));
                        sb.AppendLine("</div>");

                        sb.AppendLine("<div class='buildErrors'><div class='err'>దోషాలు</div>");
                        sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                        sb.AppendLine("</div>");
                    }
                    else
                    {
                        sb.AppendLine("<div class='build2'><div class='err'>దోషాలు</div>");
                        sb.AppendLine(MR.ShowErrors(OutputFormat.HTML));
                        sb.AppendLine("</div>");

                        sb.AppendLine("<div  class='buildErrors'><div class='err'>గణ విభజన</div>");
                        sb.AppendLine(P.Build(MR));
                        sb.AppendLine("</div>");
                    }
                }
            }
            else
            {
                try
                {
                    sb.AppendLine("<div class='build'><div class='err'>" + R.ShortName + "</div><div class='Err22'>");
                    sb.AppendLine(P.Build2(MR));
                    sb.AppendLine("</div></div>");
                }
                catch
                {
                }

                sb.AppendLine("<div class='build3'><div class='err right'>గణ విభజన</div>");
                sb.AppendLine(P.Build(MR));
                sb.AppendLine("</div>");
            }

            if (Candidates != null && MR.Percentage != 100 && Candidates.Count >= 1)
            {
                sb.AppendLine("<div class='candidates'>");
                sb.AppendLine("<div class='err'>సమీప ఫలితాలు</div>");
                sb.AppendLine("<ol style='cursor:pointer;' class='num'>");
                for (int i = 0; i < Candidates.Count; i++)
                {
                    if (i > 5 || (i == 0 && MR.Percentage >= 50 && !handleProse))
                    {
                        continue;
                    }
                    MatchResult _MR = Candidates[i];
                    sb.AppendLine("<li  id='candiate_" + i + "' data='" + _MR.Rule.Identifier + "'>" + _MR.Rule.Name);
                    sb.AppendLine(": <b style='color:red'>" + Number.ParseFloat(_MR.Percentage.ToString()).ToFixed() + "%</b>");
                    sb.AppendLine("</li>");
                }
                sb.AppendLine("</ol>");
                sb.Append(Strings.Help);
                sb.AppendLine("</div>");
            }

            return((string)Script.Literal("sb.toString2()", null));
        }