Ejemplo n.º 1
0
        private IndicAkshar[] LeftTrimLines(IndicAkshar[] input)
        {
            List <IndicAkshar> List = new List <IndicAkshar>();
            bool newLineFound       = false;

            foreach (IndicAkshar ICS in input)
            {
                if (ICS.ToString2() == Constants.NewLine)
                {
                    newLineFound = true;
                    List.Add(ICS);
                    continue;
                }
                if (newLineFound)
                {
                    if (ICS.ToString2() == Constants.Space)
                    {
                        continue;
                    }
                }
                newLineFound = false;
                List.Add(ICS);
            }
            IndicAkshar[] output = new IndicAkshar[List.Count];
            for (int i = 0; i < List.Count; i++)
            {
                output[i] = List[i];
            }
            return(output);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 public TeluguAksharam(IndicAkshar C)
 {
     this.Chars = C.Chars;
 }