private bool AnuSeriesYati(string s1, string s2) { bool f = false; bool _f1 = StringPlus.Contains("ంట,ంఠ,ండ,ంఢ", s1); bool _f2 = StringPlus.Contains("ంత,ంథ,ంద,ంధ", s2); if (_f1 && _f2) { //అనుస్వార సంబంధ యతులు return(true); } if (_f1) { bool _f = StringPlus.Contains("న", s2); if (_f) { //అనునాసికాక్షర యతులు return(true); } } if (_f1) { bool _f = StringPlus.Contains("ణ", s2); if (_f) { //అనునాసికాక్షర యతులు return(true); } } return(f); }
public static string Mapped(string[] s) { string ret = ""; for (int i = 0; i < s.Length; i++) { string CurrStr = s[i]; string LockedStr = ""; for (int j = 0; j < CurrStr.Length; j++) { char CurrChar = CurrStr[j]; //if (LockedChar.Contains(CurrChar.ToString())) if (StringPlus.Contains(LockedChar, CurrChar.ToString())) { LockedStr = LockedStr + CurrChar; } else { ret = ret + Map(LockedStr + CurrChar); LockedStr = ""; } } ret = ret + Map(LockedStr); } return(ret); }
public static bool CanIgonre(char Char) { { bool ret = false; string MatchString = IgnoreSet; //ret = MatchString.Contains(Char.ToString()); ret = StringPlus.Contains(MatchString, Char.ToString()); return(ret); } }
public static bool IsNumber(char Char) { { bool ret = false; string MatchString = NumberSet; //ret = MatchString.Contains(Char.ToString()); ret = StringPlus.Contains(MatchString, Char.ToString()); return(ret); } }
public static bool IsSpecialFinishing(char Char) { { bool ret = false; string MatchString = SpecialFinishSet; //ret = MatchString.Contains(Char.ToString()); ret = StringPlus.Contains(MatchString, Char.ToString()); return(ret); } }
public static bool IsSmallAchchu(char Char) { { bool ret = false; string MatchString = SmallAchchuSet; //ret = MatchString.Contains(Char.ToString()); ret = StringPlus.Contains(MatchString, Char.ToString()); return(ret); } }
private bool MatchYatiFinishGroups(string s1, string s2) { bool f = false; List <string> C1 = ExtractFinish(s1); List <string> C2 = ExtractFinish(s2); if (C1.Count == 0 && C2.Count == 0) { return(true); } if (C1.Count == 0) { //Match only 'అ' Group foreach (string _s in C2) { f = StringPlus.Contains(AGroup, _s); if (f) { return(true); } } } if (C2.Count == 0) { //Match only 'అ' Group foreach (string _s in C1) { f = StringPlus.Contains(AGroup, _s); if (f) { return(true); } } } for (int i = 0; i < C1.Count; i++) { for (int j = 0; j < C2.Count; j++) { string c1 = C1[i]; string c2 = C2[j]; f = MatchGroups(FinishGroups, c1, c2); if (f) { return(true); } } } return(f); }
private List <string> ExtractConsoOrFinish(string s1) { List <string> L = new List <string>(); foreach (char c in StringPlus.ToCharArray(s1)) { bool f = StringPlus.Contains(Y, c.ToString()); if (f) { L.Add(c.ToString()); } } return(L); }
private List <string> ExtractConso(string s1) { List <string> L = new List <string>(); IndicAkshar IA = new IndicAkshar(); IA.SetChars(s1, I.CharSet); foreach (char c in StringPlus.ToCharArray(s1)) { bool f = StringPlus.Contains(Conso, c.ToString()); if (f) { L.Add(c.ToString()); } } return(L); }
private void InvarientVibhajana2(string s) { #region Null Check... IndicAkshar[] ICS = this.Split(s); if (ICS == null) { return; } #endregion #region Trim the Spaces at the begenning Each Line ICS = this.LeftTrimLines(ICS); #endregion #region Prepare & White Listing List <IndicAkshar> L = new List <IndicAkshar>(); int c = 0; string prev = ""; foreach (IndicAkshar A2 in ICS) { string curr = A2.ToString2(); bool bypass = false; if (A2.Chars.Length == 1) { if (StringPlus.Contains(Accept, curr)) { Raw.Add(curr); curr = " "; bypass = true; } if (StringPlus.Contains("-", curr)) { Raw.Add(curr); curr = ""; //Samasam bypass = false; } } if (!bypass) { if (!A2.IsValid || A2.Length == 0) { continue; } } #region Remove Redundnat Spaces and New Lines if (curr == prev && (curr == Constants.Space || curr == Constants.NewLine)) { continue; } #endregion IndicAkshar T = new IndicAkshar(); T.SetChars(curr, this.CharSet); if (T.IsPolluEnder) { if (c - 1 >= 0) { Raw[Raw.Count - 1] = L[c - 1].ToString2() + curr; T = GetLangAkshar(); T.SetChars(L[c - 1].ToString2() + curr, this.CharSet); L[c - 1] = T; continue; } } Raw.Add(curr); L.Add(T); prev = curr; c++; } #endregion bool NL = false; string lastSym = ""; string lastChar = ""; bool flg = false; foreach (IndicAkshar T in L) { string currSym = T.GetSymbol(); if (currSym == Constants.NewLine) { NL = true; continue; } #region Manipulate Prev Item if (T.IsCompoundChar && !T.IsPolluEnder) { if (lastChar != Constants.Blank && lastChar != Constants.Space) { if (T.ChangePrev) { lastSym = Symbols.GURUVU; } if (!T.AlwaysGuruvu) { currSym = Symbols.LAGHUVU; } } } else if (T.IsPolluEnder) { if (T.IsCompoundChar && lastChar != Constants.Blank && lastChar != Constants.Space) { if (T.ChangePrev) { lastSym = Symbols.GURUVU; } if (!T.AlwaysGuruvu) { currSym = Symbols.LAGHUVU; } } currSym = Symbols.GURUVU; } #endregion _SymbStream = _SymbStream + lastSym; _StrStream = _StrStream + lastChar + (flg ? Constants.Space : Constants.Blank); _RawStrStream = _RawStrStream + lastChar; if (lastChar != "") { _GSplit.Add(lastChar); } if (NL) { _StrStream = _StrStream + Constants.NewLine; _SymbStream = _SymbStream + Constants.NewLine; _RawStrStream = _RawStrStream + lastChar + Constants.NewLine; _GSplit.Add(Constants.NewLine); NL = false; lastChar = T.ToString2(); lastSym = currSym; continue; } lastSym = currSym; lastChar = T.ToString2(); flg = T.IsPolluEnder; } if (lastSym != Constants.Blank || lastChar != Constants.Blank) { _SymbStream = _SymbStream + lastSym; _StrStream = _StrStream + lastChar + (flg ? Constants.Space : Constants.Blank); _RawStrStream = _RawStrStream + lastChar; _GSplit.Add(lastChar); } int _prel = 0; foreach (string l in _SymbStream.Replace(" ", "").Split('\n')) { if (l.Length > 1) { _prel++; } } PreLines = _prel; }
public bool IsPrasaMatched(string s1, string s2) { //HARD FIX.. s1 = s1.Replace("ై", "ై"); s2 = s2.Replace("ై", "ై"); //Eleminate Vowel { bool f1 = StringPlus.Contains(V, s1); bool f2 = StringPlus.Contains(V, s2); if (f1 || f2) { return(true); } } TeluguParser T1 = new TeluguParser(); IndicAkshar[] A1 = T1.Split(s1); TeluguParser T2 = new TeluguParser(); IndicAkshar[] A2 = T2.Split(s2); List <string> C1 = ExtractConsoOrVowel(s1); List <string> C2 = ExtractConsoOrVowel(s2); if (A1.Length > 1) { //Somthing+Hallu^ then ignore Hallu^ ^=Virama..There is no standard rule found but from the convention being followed. Mostly I found Hallu=Na. C1 = ExtractConsoOrVowel(A1[0].ToString2()); } if (A2.Length > 1) { C2 = ExtractConsoOrVowel(A2[0].ToString2()); } if (C1.Count == C2.Count) { bool f = MatchPrasaConsos(C1, C2); if (f) { if (LastName == null) { LastName = "ప్రాసవైరము/ప్రాది ప్రాసము/శ-ప్రాసము/అభేద ప్రాస/అప్రశస్త ప్రాస/ప్రాసమైత్రి ప్రాసము/వికల్ప ప్రాస/స్వవర్గజ ప్రాసము"; } return(true); } return(MatchSantaPrasa(C1, C2)); } else { //Need to improve this algo.. if ((C1.Count == 1 && C2.Count == 2) || (C1.Count == 2 && C1.Count == 1)) { if (C1.Count == 1 && C2.Count == 2) { if (C2[1] == La || C2[1] == Ra) { C2.RemoveAt(1); bool f = MatchPrasaConsos(C1, C2); //సంయుతాసంయుత ప్రాసము if (f) { if (LastName == null) { LastName = "సంయుతాసంయుత ప్రాసము"; } return(true); } return(MatchSantaPrasa(C1, C2)); } } if (C2.Count == 1 && C1.Count == 2) { if (C1[1] == La || C1[1] == Ra) { C2.RemoveAt(1); bool f = MatchPrasaConsos(C1, C2); //సంయుతాసంయుత ప్రాసము if (f) { if (LastName == null) { LastName = "సంయుతాసంయుత ప్రాసము"; } return(true); } return(MatchSantaPrasa(C1, C2)); } } } if (C1.Count == C2.Count && (A1.Length > 1 || A2.Length > 1)) { //May need to check for Ax[Ax.Length-1] Ends with Virama..But OK for now bool f = MatchPrasaConsos(C1, C2); if (f) { return(true); } } return(MatchSantaPrasa(C1, C2)); } }
public bool IsYatiMatched(string s1, string s2) { //HARD FIX.. s1 = s1.Replace("ై", "ై"); s2 = s2.Replace("ై", "ై"); //Algo to be modified to improve Performance //భిన్న యతి,వికల్పవిరమణలు..Not Handled.. //బహుయతి నిరతి Can be implemented.. on the wrapper.. bool f = false; //Preparing for లుప్తవిసర్గస్వరవళి: Very Rude way of doing this. s1 = s1.Replace("ఽ", "అ"); s2 = s2.Replace("ఽ", "అ"); #region ౠత్వసౌమ్యవళి,ఋత్వసంబంధవళి { bool f1 = StringPlus.Contains(s1, RuKaaram); bool f2 = StringPlus.Contains(s2, RuKaaram); if (f1 && f2) { LastName = "ౠత్వసౌమ్యవళి"; return(true); // No need to check Further } if (f1 || f2) { f = StringPlus.Contains(RuGroup, s1); if (f) { LastName = "ఋత్వసంబంధవళి"; return(true); // No need to check Further } } } #endregion #region వళి { //రి-రీ-రె-రే-"ి"-"ీ"-"ె"-"ే"=ఋ-"ృ" bool f1 = StringPlus.Contains(s1, Ru) || StringPlus.Contains(s1, RuKaaram); bool f2 = StringPlus.Contains(s2, Ru) || StringPlus.Contains(s2, RuKaaram); if (f1 || f2) { char c1 = StringPlus.CharAt(f1 ? s2 : s1, 0); if (c1 == 'ర') { char c2 = StringPlus.CharAt(f1 ? s2 : s1, f1 ? (s2.Length - 1) : (s1.Length - 1)); if (c2 == 'ి' || c2 == 'ీ' || c2 == 'ె' || c2 == 'ే') { LastName = "ఋవళి"; return(true); } } } } #endregion #region స్వరప్రధానవళి { List <string> C1 = ExtractVowelorFinish(s1); List <string> C2 = ExtractVowelorFinish(s2); for (int i = 0; i < C1.Count; i++) { for (int j = 0; j < C2.Count; j++) { string c1 = C1[i]; string c2 = C2[j]; if (c1 == c2) { if (!(StringPlus.Contains(F, c1) && StringPlus.Contains(F, c2))) { //Don't MAtch Finish and Finish LastName = "స్వరప్రధానవళి"; return(true); //No need to Check Further } } bool t = MatchGroups(VowelAndFinishGroups, c1, c2); if (t) { if (!(StringPlus.Contains(F, c1) && StringPlus.Contains(F, c2))) { LastName = "స్వరప్రధానవళి"; return(true); //No need to Check Further } } } } } #endregion #region స్వరమైత్రివళి,ఋజు యతులు,వర్గ జయతులు,తద్భవవ్యాజ విశ్రమములు,విశేషవళి,బిందు యతులు,అనునాసికాక్షర యతులు,అనుస్వార సంబంధ యతులు,ప్రత్యేక యతి { List <string> C1 = ExtractConso(s1); List <string> C2 = ExtractConso(s2); #region య,హ,అ if (C1.Count == 0 || C2.Count == 0) { string c1 = C1.Count > 0 ? C1[0] : ""; string c2 = C2.Count > 0 ? C2[0] : ""; if (c1 == "య" || c1 == "హ") { if (StringPlus.Contains(s2, "అ")) { //ప్రత్యేక యతి LastName = "ప్రత్యేక యతి"; return(true); //No more checks } } if (c2 == "య" || c2 == "హ") { if (StringPlus.Contains(s1, "అ")) { //ప్రత్యేక యతి LastName = "ప్రత్యేక యతి"; return(true); } } } #endregion for (int i = 0; i < C1.Count; i++) { for (int j = 0; j < C2.Count; j++) { string c1 = C1[i]; string c2 = C2[j]; if (c1 == c2) { f = true; LastName = "సమాన హల్లు"; break; } if (c1 == "య" || c1 == "హ") { if (StringPlus.Contains(s2, "అ")) { //ప్రత్యేక యతి LastName = "ప్రత్యేక యతి"; return(true); //No more checks } } if (c2 == "య" || c2 == "హ") { if (StringPlus.Contains(s1, "అ")) { //ప్రత్యేక యతి LastName = "ప్రత్యేక యతి"; return(true); } } f = MatchGroups(ConsoGroups, c1, c2); if (f) { LastName = "స్వరమైత్రివళి/ఋజు యతులు/ఏకతరయతులు/అభేద విరతులు/అభేద వర్గ విరతులు/ఊష్మ విశ్రాంతులు/సరసయతి"; break; } } if (f) { break; } } } if (!f) { bool f1 = StringPlus.Contains(s1, "ఙ"); bool f2 = StringPlus.Contains(s2, "ఙ"); if (f1 || f2) { bool _f = StringPlus.Contains("ంక,ంఖ,ంగ,ంఘ", f1 ? s2 : s1); if (_f) { //విశేషవళి LastName = "విశేషవళి"; f = true; } } } if (!f) { bool f1 = StringPlus.Contains(s1, "న") || StringPlus.Contains(s1, "ణ"); bool f2 = StringPlus.Contains(s2, "న") || StringPlus.Contains(s2, "ణ"); if (f1 || f2) { bool _f = StringPlus.Contains(f1 ? s2 : s1, "ఙ"); if (_f) { //తద్భవవ్యాజ విశ్రమములు LastName = "తద్భవవ్యాజ విశ్రమములు"; f = true; } } } #region Probables:బిందు యతులు,అనునాసికాక్షర యతులు,అనుస్వార సంబంధ యతులు if (!f) { //ం+హల్లు Group= 5th Letter; char c1 = StringPlus.CharAt(s1, 0); char c2 = StringPlus.CharAt(s2, 0); bool f1 = (c1 == SUNNA); bool f2 = (c2 == SUNNA); if (f1 || f2) { string c2_1 = ""; string c1_1 = ""; if (f1) { c2_1 = StringPlus.CharAt(s2, 0).ToString(); c1_1 = s1.Length > 1 ? StringPlus.CharAt(s1, 1).ToString() : ""; } else { c2_1 = StringPlus.CharAt(s1, 0).ToString(); c1_1 = s2.Length > 1 ? StringPlus.CharAt(s2, 1).ToString() : ""; } switch (c2_1) { default: { f = AnuSeriesYati(s1, s2); if (!f) { f = AnuSeriesYati(s2, s1); } } if (!f) { bool _f1 = StringPlus.Contains("ంయ,ంర,ంల,ంవ,ంశ,ంస,ంష,ంహ", f1 ? s1 : s2); if (_f1) { bool _f = StringPlus.Contains("మ", f1 ? s2 : s1); if (_f) { //మువర్ణ విరామం LastName = "మువర్ణ విరామం"; return(true); //No need to check further } } } break; case "ఙ": f = StringPlus.Contains("క,ఖ,గ,ఘ", c1_1); if (f) { f = true; } break; case "ఞ": f = StringPlus.Contains("చ,ఛ,జ,ఝ", c1_1); if (f) { f = true; } break; case "ణ": f = StringPlus.Contains("త,థ,ద,ధ", c1_1) || StringPlus.Contains("ట,ఠ,డ,ఢ", c1_1); //+అనునాసికాక్షర యతులు if (f) { f = true; } break; case "న": f = StringPlus.Contains("త,థ,ద,ధ", c1_1) || StringPlus.Contains("ట,ఠ,డ,ఢ", c1_1); //+అనునాసికాక్షర యతులు if (f) { f = true; } break; case "మ": f = StringPlus.Contains("ప,ఫ,బ,భ", c1_1) || StringPlus.Contains("య,ర,ల,వ,శ,స,ష,హ", c1_1); //+మువర్ణ విరామం if (f) { f = true; } break; } } } #endregion if (f) { #region Confirm Above one's //Conso Groups Matched Now it's time to Match if their Finish matches. f = MatchYatiFinishGroups(s1, s2); #endregion } #endregion #region మువిభక్తియతి,ముకారయతి { //char c10= StringPlus.CharAt ( s1 , 0 ); //char c1n= StringPlus.CharAt ( s1 , s1.Length - 1 ); //char c20= StringPlus.CharAt ( s2 , 0 ); //char c2n= StringPlus.CharAt ( s2 , s2.Length - 1 ); //bool f1=( c10 == 'మ' && c1n == 'ు' ); //bool f2=( c20 == 'మ' && c2n == 'ు' ); //if ( f1 || f2 ) //{ // bool _f1 = StringPlus.Contains ( "పఫభబ" , ( f1 ? c20 : c10 ).ToString ( ) ); // bool _f2 = StringPlus.Contains ( "ుూొో" , ( f1 ? c2n : c1n ).ToString ( ) ); // if ( _f1 && _f2 ) // { // LastName = "మువిభక్తియతి లేదా ముకారయతి"; // return true; // } //} char c10 = StringPlus.CharAt(s1, 0); char c1n = StringPlus.CharAt(s1, s1.Length - 1); char c20 = StringPlus.CharAt(s2, 0); char c2n = StringPlus.CharAt(s2, s2.Length - 1); bool f1 = (c10 == 'మ' && StringPlus.Contains("ుూొో", c1n.ToString())); bool f2 = (c20 == 'మ' && StringPlus.Contains("ుూొో", c2n.ToString())); if (f1 || f2) { bool _f1 = StringPlus.Contains("పఫభబమ", (f1 ? c20 : c10).ToString()); bool _f2 = StringPlus.Contains("ుూొో", (f1 ? c2n : c1n).ToString()); if (_f1 && _f2) { LastName = "మువిభక్తియతి లేదా ముకారయతి"; return(true); } } } #endregion #region అంత్యోష్మ సంధి కళులు { bool f1 = StringPlus.Contains(s1, HA); bool f2 = StringPlus.Contains(s2, HA); if (f1 || f2) { if (f1 && s2.Length >= 3) { char c1 = StringPlus.CharAt(s2, 0); char c2 = StringPlus.CharAt(s2, 1); char c3 = StringPlus.CharAt(s2, 2); if (c2 == Virama) { f = IsJhuyMatch(c1, c3); if (f) { LastName = "అంత్యోష్మ సంధి కళులు"; return(true); } } } if (f2 && s1.Length >= 3) { char c1 = StringPlus.CharAt(s1, 0); char c2 = StringPlus.CharAt(s1, 1); char c3 = StringPlus.CharAt(s1, 2); if (c2 == Virama) { f = IsJhuyMatch(c1, c3); if (f) { LastName = "అంత్యోష్మ సంధి కళులు"; return(true); } } } } } #endregion if (SoundexSandhi) { f = MatchYatiFinishGroups(s1, s2); } return(f); }
private bool IsGroupMatched(string g, string s1, string s2) { bool f = StringPlus.Contains(g, s1) && StringPlus.Contains(g, s2); return(f); }