Exemplo n.º 1
0
        private static bool strConsonantes(String str)
        {
            bool cer;
            int  k;
            int  i;

            char[] c;
            cer = false;
            k   = 0;
            c   = str.ToCharArray();
            for (i = 0; (i < str.Length); i++)
            {
                if ((Divisor.letra(c[i]) > 5))
                {
                    k = (k + 1);
                }
            }

            if ((k == str.Length))
            {
                cer = true;
            }

            return(cer);
        }
Exemplo n.º 2
0
        private static bool hiato(char v, char v2)
        {
            bool cer = false;

            if ((Divisor.letra(v) < 4))
            {
                if ((Divisor.letra(v2) < 4))
                {
                    cer = true;
                }
            }
            else
            {
                if ((Divisor.letra(v2) < 4))
                {
                    cer = false;
                }
                else
                {
                    if ((v == v2))
                    {
                        cer = true;
                    }
                    else
                    {
                        cer = false;
                    }
                }
            }

            return(cer);
        }
Exemplo n.º 3
0
        private static String silabaRest(String str)
        {
            String s2;

            s2 = Divisor.silaba(str);
            return(str.Substring(s2.Length));
        }
Exemplo n.º 4
0
        private string separated = ""; //Almacena como va quedadno la palabra separada
        public void separa(string a)
        {
            s = a;
            String[] palabras = s.Split(new string[] { " " }, StringSplitOptions.None);
            Divisor  divisor  = new Divisor();

            for (int i = 0; i < palabras.Length; i++)
            {
                divisor.setString((String)palabras[i]);
                separated = separated + " " + divisor.silabear();
            }
            Console.WriteLine(separated);
            Console.Read();
        }
Exemplo n.º 5
0
        public String silabear()
        {
            String temp;
            String s = "";
            int    k;
            int    i;

            k    = this.cadena.Length;
            temp = this.cadena;
            for (i = 0; (i < k); i++)
            {
                temp = Divisor.silaba(this.cadena);
                if ((i == 0))
                {
                    s = (s + temp);
                }
                else if (Divisor.strConsonantes(temp))
                {
                    s = (s + temp);
                }
                else if (Divisor.strVVstr(s, temp))
                {
                    s = (s + temp);
                }
                else if (Divisor.strConsonantes(s))
                {
                    s = (s + temp);
                }
                else
                {
                    s = (s + ("-" + temp));
                }

                i           = (i + (temp.Length - 1));
                this.cadena = Divisor.silabaRest(this.cadena);
            }

            return(s);
        }
Exemplo n.º 6
0
        private static bool strVVstr(String s1, String s2)
        {
            bool cer;
            char c2;
            char c1;

            c1  = s1[(s1.Length - 1)];
            c2  = s2[0];
            cer = false;
            if (((Divisor.letra(c1) < 6) &&
                 (Divisor.letra(c2) < 6)))
            {
                if (Divisor.hiato(c1, c2))
                {
                    cer = false;
                }
                else
                {
                    cer = true;
                }
            }

            return(cer);
        }
Exemplo n.º 7
0
        private static String silaba(String str)
        {
            String temp = "";
            String s    = "";
            char   z;
            char   x;
            char   y;

            if ((str.Length < 3))
            {
                if ((str.Length == 2))
                {
                    x = str[0];
                    y = str[1];
                    if (((Divisor.letra(x) < 6) &&
                         (Divisor.letra(y) < 6)))
                    {
                        if (Divisor.hiato(x, y))
                        {
                            s = str.Substring(0, 1);
                        }
                        else
                        {
                            s = str;
                        }
                    }
                    else
                    {
                        s = str;
                    }
                }
                else
                {
                    s = str;
                }
            }
            else
            {
                x = str[0];
                y = str[1];
                z = str[2];
                if ((Divisor.letra(x) < 6))
                {
                    // V ? ?
                    if ((Divisor.letra(y) < 6))
                    {
                        // V V ?
                        if ((Divisor.letra(z) < 6))
                        {
                            // V V V
                            if (Divisor.hiato(x, y))
                            {
                                s = str.Substring(0, 1);
                            }
                            else if (Divisor.hiato(y, z))
                            {
                                s = str.Substring(0, 2);
                            }
                            else
                            {
                                s = str.Substring(0, 3);
                            }
                        }
                        else
                        {
                            //  V V C
                            if (Divisor.hiato(x, y))
                            {
                                s = str.Substring(0, 1);
                            }
                            else
                            {
                                s = str.Substring(0, 2);
                            }
                        }
                    }
                    else
                    {
                        //  V C ?
                        if ((Divisor.letra(z) < 6))
                        {
                            // V C V
                            if ((Divisor.letra(y) == 6))
                            {
                                //  V H C
                                if (Divisor.hiato(x, z))
                                {
                                    s = str.Substring(0, 1);
                                }
                                else
                                {
                                    s = str.Substring(0, 3);
                                }
                            }
                            else
                            {
                                s = str.Substring(0, 1);
                            }
                        }
                        else
                        {
                            //  V C C
                            if (Divisor.consonantes1(y, z))
                            {
                                s = str.Substring(0, 1);
                            }
                            else
                            {
                                s = str.Substring(0, 2);
                            }
                        }
                    }
                }
                else
                {
                    //  C ??
                    if ((Divisor.letra(y) < 6))
                    {
                        // C V ?
                        if ((Divisor.letra(z) < 6))
                        {
                            //  C V V
                            temp = str.Substring(0, 3);
                            if ((temp.Equals("que") ||
                                 (temp.Equals("qui") ||
                                  (temp.Equals("gue") || temp.Equals("gui")))))
                            {
                                s = str.Substring(0, 3);
                            }
                            else if (Divisor.hiato(y, z))
                            {
                                s = str.Substring(0, 2);
                            }
                            else
                            {
                                s = str.Substring(0, 3);
                            }
                        }
                        else
                        {
                            //  C V C
                            s = str.Substring(0, 2);
                        }
                    }
                    else
                    {
                        //  C C ?
                        if ((Divisor.letra(z) < 6))
                        {
                            //  C C V
                            if (Divisor.consonantes1(x, y))
                            {
                                s = str.Substring(0, 3);
                            }
                            else
                            {
                                s = str.Substring(0, 1);
                            }
                        }
                        else
                        {
                            //  C C C
                            if (Divisor.consonantes1(y, z))
                            {
                                s = str.Substring(0, 1);
                            }
                            else
                            {
                                s = str.Substring(0, 1);
                            }
                        }
                    }
                }
            }

            return(s);
        }