Esempio n. 1
0
        private string YatiString(string nm, string yati, int p)
        {
            string s       = "";
            bool   matched = false;

            while (!matched)
            {
                s = StringWith1(nm);
                string lp = s.Split(',')[p];
                matched = Y.IsYatiMatched(lp, yati);
            }
            return(s);
        }
Esempio n. 2
0
    private bool YatiCheck(string s1, string s2, bool Sandhi)
    {
        YatiPrasaChecker2 Y = new YatiPrasaChecker2( );

        Y.SoundexSandhi = Sandhi;
        bool f = Y.IsYatiMatched(s1, s2);

        return(f);
    }
Esempio n. 3
0
    private string Build(string[][] M)
    {
        string            S = " ";
        YatiPrasaChecker2 Y = new YatiPrasaChecker2( );

        foreach (string[] s in M)
        {
            {
                bool f = Y.IsYatiMatched(s[2], s[3]);
                if (!f)
                {
                    S = S + "<tr" + (f ? " " : " style='color:red;'") + "><td>" + s[0] + "</td><td>" + s[1] + "</td><td>" + s[2] + "</td><td>" + s[3] + "</td><td>" + f.ToString( ) + "</td></tr>";
                }
            }
            {
                bool f = Y.IsYatiMatched(s[3], s[2]);
                if (!f)
                {
                    S = S + "<tr" + (f ? " " : " style='color:red;'") + "><td>" + s[0] + "</td><td>" + s[1] + "</td><td>" + s[3] + "</td><td>" + s[2] + "</td><td>" + f.ToString( ) + "</td></tr>";
                }
            }
        }
        return(S == " " ? "<h2>Perfect</h2>" : "<table>" + S + "</table>");
    }
Esempio n. 4
0
        //private List<Range> GetList (string tag , string s)
        //{
        //    List<Range> R= new List<Range> ( );
        //    int last=0;
        //    while ( last < s.Length && s.IndexOf ( "<" + tag + ">" , last ) != -1 )
        //    {
        //        int from =s.IndexOf ( "<" + tag + ">" , last );
        //        int to=s.IndexOf ( "</" + tag + ">" , last );

        //        Range _R= new Range ( );
        //        _R.From = from+1;
        //        _R.Length = to - from;

        //        R.Add ( _R );
        //        last = to + 4;
        //    }
        //    return R;
        //}



        internal void VerifyYati()
        {
            Console.WriteLine("Yati Check...");

            int               s         = 0;
            int               fa        = 0;
            char              seperator = '\t';
            StreamReader      SR        = new StreamReader("Yati.txt");
            StreamWriter      SS        = new StreamWriter("Yati_Pass.txt");
            StreamWriter      SF        = new StreamWriter("Yati_Fail.txt");
            YatiPrasaChecker2 Y         = new YatiPrasaChecker2( );

            while (!SR.EndOfStream)
            {
                string   line = SR.ReadLine( );
                string[] j    = line.Split(seperator);
                if (j.Length > 2)
                {
                    string y1 = j[0];
                    string y2 = j[1];
                    string y3 = j[2];


                    bool f = Y.IsYatiMatched(y1, y2);
                    if (f)
                    {
                        SS.WriteLine(y1 + "|" + y2 + "");
                        SS.Flush( );
                        s++;
                    }
                    else
                    {
                        SF.WriteLine(y1 + "|" + y2 + "|" + y3);
                        SF.Flush( );
                        fa++;
                    }
                }
            }
            SS.Close( );
            SF.Close( );
            Console.WriteLine("Pass: "******"Fail: " + fa.ToString( ));
            Console.WriteLine("Tot: " + (s + fa).ToString( ));
        }
Esempio n. 5
0
        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);
                }
            }
        }