protected void YCheck_Click(object sender, EventArgs e) { GanaVibhajana G1 = new GanaVibhajana(TextBox1.Text, Chandam.Rules.RuleLanguage.Telugu); bool f = YatiCheck(TextBox1.Text, TextBox2.Text, false); string s = f ? String.Format("Yati matached between <b>{0}</b> and <b>{1}</b>", TextBox1.Text, TextBox2.Text) : String.Format("Yati <b>Not</b> matached between <b>{0}</b> and <b>{1}</b>", TextBox1.Text, TextBox2.Text); result.InnerHtml = s; }
private string StringWithList(int w, List <string> whiteList) { string s = ""; string nm = ""; while (!whiteList.Contains(nm)) { s = StringWith_i(w); GanaVibhajana G = new GanaVibhajana(s, lang); nm = GDefinition.GName(G.SymbolsStream.Replace(" ", "")).Trim(); } return(s); }
private string StringWith2(int w, string blackList) { string s = ""; string nm = blackList; while (nm == blackList) { s = StringWith_i(w); GanaVibhajana G = new GanaVibhajana(s, lang); nm = GDefinition.GName(G.SymbolsStream.Replace(" ", "")).Trim(); } return(s); }
private string PrasaString3(int w, string prasa, string blackList) { string s = ""; string nm = blackList; while (nm == blackList) { s = PrasaString(w, prasa); GanaVibhajana G = new GanaVibhajana(s, lang); nm = GDefinition.GName(G.SymbolsStream.Replace(" ", "")).Trim(); } return(s); }
private string YatiString3(int w, string yati, string blackList) { string s = ""; string nm = blackList; while (nm == blackList) { s = YatiString2(w, yati); GanaVibhajana G = new GanaVibhajana(s, lang); nm = GDefinition.GName(G.SymbolsStream.Replace(" ", "")).Trim(); } return(s); }
public string CheckPrasa(string s1, string s2, bool allowSantiPrasa) { YatiPrasaChecker2 Y = new YatiPrasaChecker2(); s1 = s1.Replace(" ", ""); s2 = s2.Replace(" ", ""); Y.AllowSantiPrasa = allowSantiPrasa; Y.SoundexSandhi = false; GanaVibhajana G1 = new GanaVibhajana(s1, lang); GanaVibhajana G2 = new GanaVibhajana(s2, lang); if (G1.GWiseString.Count == 0) { return("<span class='gName'>Group-1 is not valid</span>"); } if (G2.GWiseString.Count == 0) { return("<span class='gName'>Group-2 is not valid</span>"); } bool f = false; if (G1.GWiseString.Count > 1 && G2.GWiseString.Count > 1) { p1 = G1.GWiseString[0] + "<u>" + G1.GWiseString[1] + "</u>"; p2 = G2.GWiseString[0] + "<u>" + G2.GWiseString[1] + "</u>"; Prasa P1 = new Prasa(StringPlus.CharAt(G1.SymbolsStream, 0).ToString(), false, G1.GWiseString[1], G1.GWiseString[0]); Prasa P2 = new Prasa(StringPlus.CharAt(G2.SymbolsStream, 0).ToString(), false, G2.GWiseString[1], G2.GWiseString[0]); f = Y.IsPrasaMatched3(P1, P2); if (f && Y.NoMoreChecks) { return(Success(p1, p2, PRASA, Y.LastName)); } if (f) { if (P1.Symbol == Symbols.LAGHUVU) { //Nothing to do.. } else { f = (P1.Symbol == P2.Symbol); } } if (f) { Errors E = CheckPrasaPoorva2(Y, P1, P2); if (E == null) { return(Success(p1, p2, PRASA, Y.LastName)); } return(FailWith(p1, p2, E, PRASA)); } else { return(FailWith(p1, p2, null, PRASA)); } } else { p1 = G1.GWiseString[0]; p2 = G2.GWiseString[0]; f = Y.IsPrasaMatched(p1, p2); if (f) { return(Success(p1, p2, PRASA, Y.LastName)); } } return(FailWith(p1, p2, null, PRASA)); }
public string CheckYati(string s1, string s2, bool Sandhi) { GanaVibhajana G1 = new GanaVibhajana(s1, lang); GanaVibhajana G2 = new GanaVibhajana(s2, lang); if (G1.GWiseString.Count == 0) { return("<span class='gName'>Group-1 is not valid</span>"); } if (G2.GWiseString.Count == 0) { return("<span class='gName'>Group-2 is not valid</span>"); } string c1 = null; string y1 = null; string py1 = null; string c2 = null; string y2 = null; string py2 = null; YatiPrasaChecker2 YPC = new YatiPrasaChecker2(); YPC.SoundexSandhi = Sandhi; #region ... if (G1.GWiseString.Count == 3) { c1 = StringPlus.EndsWith(G1.GWiseString[0], 'ం') ? "ం" : null; y1 = G1.GWiseString[1]; py1 = G1.GWiseString[2]; p1 = (c1 != null) ? G1.GWiseString[0] + G1.GWiseString[1] : G1.GWiseString[1]; p1 = p1 + G1.GWiseString[2]; } if (G1.GWiseString.Count == 2) { c1 = StringPlus.EndsWith(G1.GWiseString[0], 'ం') ? "ం" : null; y1 = G1.GWiseString[1]; p1 = (c1 != null) ? G1.GWiseString[0] + G1.GWiseString[1] : G1.GWiseString[1]; } if (G2.GWiseString.Count == 3) { c2 = StringPlus.EndsWith(G2.GWiseString[0], 'ం') ? "ం" : null; y2 = G2.GWiseString[1]; py2 = G2.GWiseString[2]; p2 = (c2 != null) ? G2.GWiseString[0] + G2.GWiseString[1] : G2.GWiseString[1]; p2 = p2 + G2.GWiseString[2]; } if (G1.GWiseString.Count == 1) { y1 = G1.GWiseString[0]; p1 = G1.GWiseString[0]; } if (G2.GWiseString.Count == 2) { c2 = StringPlus.EndsWith(G2.GWiseString[0], 'ం') ? "ం" : null; y2 = G2.GWiseString[1]; p2 = (c2 != null) ? G2.GWiseString[0] + G2.GWiseString[1] : G2.GWiseString[1]; } if (G2.GWiseString.Count == 1) { y2 = G2.GWiseString[0]; p2 = G2.GWiseString[0]; } #endregion bool res = YPC.IsYatiMatched(p1, p2); if (res) { return(Success(p1, p2, YATI, YPC.LastName)); } else { //Context not matched so prepare for Prasa Yati if (G1.GWiseString.Count == 2) { y1 = G1.GWiseString[0]; py1 = G1.GWiseString[1]; } if (G2.GWiseString.Count == 2) { y2 = G2.GWiseString[0]; py2 = G2.GWiseString[1]; } res = YPC.IsYatiMatched(y1, y2); if (res) { return(Success(y1, y2, YATI, YPC.LastName)); } else { string s = FailWith(p1, p2, null, YATI); if (G1.GWiseString.Count > 1 && G2.GWiseString.Count > 1) { s = s + "<br/>అందువల్ల ప్రాస యతి సరి పోతుందేమో చూస్తున్నా<br/>"; s = s + CheckPrasa(py1, py2, false); } return(s); } } }