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)); }
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 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)); }
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); }
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)); }
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); ; }
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); }
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)); }
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); }