Пример #1
0
        private static string AddPostfixTest()
        {
            ArWord word = new ArWord("كَتَبَ");

            word.addPostfix("تُ");
            return(word.ToLetString());
        }
Пример #2
0
        public void addPostfix(string input)
        {
            Exception e = new Exception("ERROR: adding postfix.");

            //special rule! Adding plural to female
            //if (input == "َاتٌ")
            //{
            //    if (this[Count - 1].Cons == 'ة')
            //    {
            //        RemoveAt(Count - 1);
            //        this[Count - 1].Vowel = '0';
            //    }
            //}

            if (input == "")
            {
                return;              //nothing we need to do.
            }
            ArWord postfix = new ArWord(input);

            if (this[Count - 1].Vowel != '0') //there IS a vowel in the last "letter"
            {
                if (postfix[0].Cons == '0')   //if there is no consonance in the postfix, adding is not legitimate.
                {
                    throw e;
                }

                AddRange(postfix); //normal adding of the postfix.
            }
            else //there is no vowel
            {
                if (postfix[0].Cons != '0') // postfix does not begin with a vowel - easy adding
                {
                    AddRange(postfix);
                }

                else //tricky part - I don't have a vowel but postfix begin with.
                {
                    this[Count - 1].Vowel = postfix[0].Vowel;
                    postfix.RemoveAt(0); //remove the one that contained only a vowel.

                    if (postfix.Count == 0)
                    {
                        return;
                    }

                    //merging identical consonants

                    if (this[Count - 1].Vowel == Letter.sukun && this[Count - 1].Cons == postfix[0].Cons)
                    {
                        RemoveAt(Count - 1);
                        postfix[0].IsShada = true;
                    }
                    AddRange(postfix);
                }
            }
        }
Пример #3
0
        private static string ArWordTest()
        {
            //ArWord postfix = new ArWord("ْتُنَّ");
            //ArWord word  = new ArWord("كَتَب");
            //ArWord merged = word + postfix;
            ArWord word = new ArWord("الفعل");

            return(word.ToLetString());
        }
Пример #4
0
        }                   //default C'tor

        //copy c'tor
        public ArWord(ArWord referece) : base(referece)
        {
        }                                                   //using the base copy constructor