/* turns terminal y to i when there is another vowel in the stem. */
 public void PerformStep2(TokenSource source)
 {
     if (source.EndsWith('y') &&
         source.ContainsVowel(source.Size - 2)
         )
     {
         source.Buffer[source.Size - 1] = 'i';
     }
 }
        /* gets rid of plurals and -ed or -ing. e.g.
         *                 caresses  ->  caress
         *                 ponies    ->  poni
         *                 ties      ->  ti
         *                 caress    ->  caress
         *                 cats      ->  cat
         *
         *                 feed      ->  feed
         *                 agreed    ->  agree
         *                 disabled  ->  disable
         *
         *                 matting   ->  mat
         *                 mating    ->  mate
         *                 meeting   ->  meet
         *                 milling   ->  mill
         *                 messing   ->  mess
         *
         *                 meetings  ->  meet
         *
         */
        public void PerformStep1(TokenSource source)
        {
            if (source.EndsWith('s'))
            {
                if (source.EndsWith("sses") || source.EndsWith("ies"))
                {
                    source.Size -= 2;
                }
                else if (source.Size >= 2 && source.Buffer[source.Size - 2] != 's')
                {
                    source.Size -= 1;
                }
            }

            if (source.EndsWith("eed"))
            {
                var limit = source.Size - 3; // source.Length
                if (source.NumberOfConsoantSequences(limit) > 0)
                {
                    source.Size -= 1;
                }
            }
            else
            {
                var limit = 0;
                if (source.EndsWith("ed"))
                {
                    limit = source.Size - 2;
                }
                else if (source.EndsWith("ing"))
                {
                    limit = source.Size - 3;
                }

                if (limit != 0 && source.ContainsVowel(limit))
                {
                    source.Size = limit;
                    if (
                        source.EndsWith("at") ||
                        source.EndsWith("bl") ||
                        source.EndsWith("iz")
                        )
                    {
                        source.InsertIntoBuffer('e');
                    }
                    else if (source.EndsWithDoubleConsonant())
                    {
                        var ch = source.LastChar;
                        if (ch != 'l' && ch != 's' && ch != 'z')
                        {
                            source.Size--;
                        }
                    }
                    else if (
                        source.NumberOfConsoantSequences(source.Size - 1) == 1 &&
                        source.HasCvcAt(source.Size - 1)
                        )
                    {
                        source.InsertIntoBuffer('e');
                    }
                }
            }
        }