public static Boolean Vocal(string letra) { Boolean Ctrl; String[] letras; String acentuadas, normal; acentuadas = "áéíóúü"; normal = "aeiouu"; for (int i = 0; i < acentuadas.Length; i++) { if (letra == LeftRightMid.Mid(acentuadas, i, 1)) { letra = LeftRightMid.Mid(normal, i, 1); } } Ctrl = false; letra = letra.Trim().ToLower(); letras = new string[5] { "a", "e", "i", "o", "u" }; if (letras.Contains(letra)) { Ctrl = true; } return(Ctrl); }
public static Boolean Diptongo(string Dip) { Boolean Ctrl; int I; String[] letras; String acentuadas, normal; acentuadas = "ü"; normal = "u"; if (acentuadas == LeftRightMid.Mid(Dip, 0, 1)) { Dip.Replace(acentuadas, normal); } if (acentuadas == LeftRightMid.Mid(Dip, 1, 1)) { Dip.Replace(acentuadas, normal); } Ctrl = false; Dip = Dip.Trim().ToLower(); letras = new string[15] { "ai", "au", "ei", "eu", "oi", "ou", "ia", "ie", "io", "ua", "ue", "uo", "ui", "iu", "ou" }; foreach (string letra in letras) { if (letra == Dip) { Ctrl = true; } } return(Ctrl); }
public static int Cantidad(string palabra, int p) { int I; for (I = p; I < palabra.Length; I++) { if (Vocal(LeftRightMid.Mid(palabra, I, 1))) { break; } } if (I - p == 0) { I = 1; } else { I = I - p; } return(I); }
public static String Silabas(string palabra) { int I; String sil; switch (palabra) { case "limpiáis": sil = "lim piáis"; break; case "limpiéis": sil = "lim piéis"; break; default: switch (palabra.Length) { case 1: sil = palabra; break; case 2: sil = palabra; break; case 3: if (Consonante(LeftRightMid.Mid(palabra, 0, 1))) { if (Consonante(LeftRightMid.Mid(palabra, 1, 1))) { sil = palabra; } else if (Diptongo(LeftRightMid.Mid(palabra, 1))) { sil = palabra; } else if (Vocal(LeftRightMid.Mid(palabra, 2))) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + LeftRightMid.Mid(palabra, 2); } else { sil = palabra; } } else { if (Diptongo(LeftRightMid.Mid(palabra, 0, 2))) { sil = palabra; } else { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + LeftRightMid.Mid(palabra, 1); } } break; case 4: if (Consonante(LeftRightMid.Mid(palabra, 0, 1))) { if (GrupoC(LeftRightMid.Mid(palabra, 0, 2))) { if (Diptongo(LeftRightMid.Mid(palabra, 2, 2))) { sil = palabra; } else { if (Vocal(LeftRightMid.Mid(palabra, 3))) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + LeftRightMid.Mid(palabra, 3); } else { sil = palabra; } } } else { if (Diptongo(LeftRightMid.Mid(palabra, 1, 2))) { sil = palabra; } else { if (palabra.Contains("sub")) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + LeftRightMid.Mid(palabra, 3); } else { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + LeftRightMid.Mid(palabra, 2); } } } } else { if (Diptongo(LeftRightMid.Mid(palabra, 0, 2))) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + LeftRightMid.Mid(palabra, 2); } else { if (Vocal(LeftRightMid.Mid(palabra, 1, 1))) { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); } else { if (GrupoC(LeftRightMid.Mid(palabra, 1, 2))) { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + LeftRightMid.Mid(palabra, 1); } else { if (Consonante(LeftRightMid.Mid(palabra, 2, 1))) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + LeftRightMid.Mid(palabra, 2); } else { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); } } } } } break; case 5: if (Consonante(LeftRightMid.Mid(palabra, 0, 1))) { if (GrupoC(LeftRightMid.Mid(palabra, 0, 2))) { if (Diptongo(LeftRightMid.Mid(palabra, 2, 2))) { sil = palabra; } else { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + LeftRightMid.Mid(palabra, 3); } } else { if (Diptongo(LeftRightMid.Mid(palabra, 1, 2))) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + LeftRightMid.Mid(palabra, 3); } else { switch (Cantidad(palabra, 2)) { case 1: sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); break; case 2: if (!GrupoC(LeftRightMid.Mid(palabra, 2, 2))) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } else { if (palabra.Contains("sub")) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } else { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); } } break; default: sil = palabra; break; } } } } else { if (Diptongo(LeftRightMid.Mid(palabra, 0, 2))) { sil = LeftRightMid.Mid(palabra, 0, 1) + Silabas(LeftRightMid.Mid(palabra, 1)); } else { if (Vocal(LeftRightMid.Mid(palabra, 1, 1))) { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); } else { if (GrupoC(LeftRightMid.Mid(palabra, 1, 2))) { if (palabra.Contains("ubr")) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); } else { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); } } else { switch (Cantidad(palabra, 1)) { case 1: sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); break; case 2: sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); break; case 3: sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); break; default: sil = palabra; break; } } } } } break; default: if (Consonante(LeftRightMid.Mid(palabra, 0, 1))) { if (LeftRightMid.Mid(palabra, 0, 3) == "sub") { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } else { if (GrupoC(LeftRightMid.Mid(palabra, 0, 2))) { sil = LeftRightMid.Mid(palabra, 0, 2) + Silabas(LeftRightMid.Mid(palabra, 2)); } else { sil = LeftRightMid.Mid(palabra, 0, 1) + Silabas(LeftRightMid.Mid(palabra, 1)); } } } else { if (Diptongo(LeftRightMid.Mid(palabra, 0, 2))) { switch (Cantidad(palabra, 2)) { case 1: sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); break; case 2: if (!GrupoC(LeftRightMid.Mid(palabra, 2, 2))) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } else { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); } break; case 3: if (GrupoC(LeftRightMid.Mid(palabra, 3, 2))) { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } else { sil = LeftRightMid.Mid(palabra, 0, 4) + " " + Silabas(LeftRightMid.Mid(palabra, 4)); } break; case 4: sil = LeftRightMid.Mid(palabra, 0, 4) + " " + Silabas(LeftRightMid.Mid(palabra, 4)); break; default: sil = palabra; break; } } else { switch (Cantidad(palabra, 1)) { case 1: sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); break; case 2: if (!GrupoC(LeftRightMid.Mid(palabra, 1, 2))) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); } else { sil = LeftRightMid.Mid(palabra, 0, 1) + " " + Silabas(LeftRightMid.Mid(palabra, 1)); } break; case 3: if (GrupoC(LeftRightMid.Mid(palabra, 2, 2))) { sil = LeftRightMid.Mid(palabra, 0, 2) + " " + Silabas(LeftRightMid.Mid(palabra, 2)); } else { sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); } break; case 4: sil = LeftRightMid.Mid(palabra, 0, 3) + " " + Silabas(LeftRightMid.Mid(palabra, 3)); break; default: sil = palabra; break; } } } break; } break; } return(sil); }