Esempio n. 1
0
        /// <summary>
        ///     Removes tashkeel from text.
        /// </summary>
        public static void RemoveTashkeel(FastStringBuilder input)
        {
            for (int i = 0; i < input.Length; i++)
            {
                switch ((TashkeelCharacters)input.Get(i))
                {
                case TashkeelCharacters.Fathan:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Fathan, i));
                    break;

                case TashkeelCharacters.Dammatan:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Dammatan, i));
                    break;

                case TashkeelCharacters.Kasratan:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Kasratan, i));
                    break;

                case TashkeelCharacters.Fatha:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Fatha, i));
                    break;

                case TashkeelCharacters.Damma:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Damma, i));
                    break;

                case TashkeelCharacters.Kasra:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Kasra, i));
                    break;

                case TashkeelCharacters.Shadda:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Shadda, i));
                    break;

                case TashkeelCharacters.Sukun:
                    TashkeelLocations.Add(new TashkeelLocation(TashkeelCharacters.Sukun, i));
                    break;

                case TashkeelCharacters.MaddahAbove:
                    TashkeelLocations.Add(
                        new TashkeelLocation(TashkeelCharacters.MaddahAbove, i));
                    break;

                case TashkeelCharacters.SuperscriptAlef:
                    TashkeelLocations.Add(
                        new TashkeelLocation(TashkeelCharacters.SuperscriptAlef, i));
                    break;
                }
            }


            input.RemoveAll((char)TashkeelCharacters.Fathan);
            input.RemoveAll((char)TashkeelCharacters.Dammatan);
            input.RemoveAll((char)TashkeelCharacters.Kasratan);
            input.RemoveAll((char)TashkeelCharacters.Fatha);
            input.RemoveAll((char)TashkeelCharacters.Damma);
            input.RemoveAll((char)TashkeelCharacters.Kasra);
            input.RemoveAll((char)TashkeelCharacters.Shadda);
            input.RemoveAll((char)TashkeelCharacters.Sukun);
            input.RemoveAll((char)TashkeelCharacters.MaddahAbove);
            input.RemoveAll((char)TashkeelCharacters.ShaddaWithFathaIsolatedForm);
            input.RemoveAll((char)TashkeelCharacters.ShaddaWithDammaIsolatedForm);
            input.RemoveAll((char)TashkeelCharacters.ShaddaWithKasraIsolatedForm);
            input.RemoveAll((char)TashkeelCharacters.SuperscriptAlef);
        }