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); }
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)); }
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)); }
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)); }
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()); }
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( )); }
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 />", " "); string e = MR.ShowErrors(OutputFormat.Text).Replace("\n", " "); 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( )); }
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()); }
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()); }
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)); }