public string Process(string input)
        {
            var words = input.Split(' ',
                                    StringSplitOptions.RemoveEmptyEntries);

            StringBuilder builder = new StringBuilder();

            PorterStemmerFilter s;

            foreach (var currentWord in words)
            {
                s = new PorterStemmerFilter();
                s.add(currentWord.ToCharArray(), currentWord.Length);
                s.stem();

                builder.Append(s.ToString()).Append(' ');
            }

            return(builder.ToString().Trim());
        }
        /** Test program for demonstrating the Stemmer.  It reads text from a
         * a list of files, stems each word, and writes the result to standard
         * output. Note that the word stemmed is expected to be in lower case:
         * forcing lower case must be done outside the Stemmer class.
         * Usage: Stemmer file-name file-name ...
         */
        public static void Main(String[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Usage:  Stemmer <input file>");
                return;
            }
            char[] w = new char[501];
            PorterStemmerFilter s = new PorterStemmerFilter();

            for (int i = 0; i < args.Length; i++)
            {
                try
                {
                    FileStream _in = new FileStream(args[i], FileMode.Open, FileAccess.Read);
                    try
                    {
                        while (true)
                        {
                            int ch = _in.ReadByte();
                            if (Char.IsLetter((char)ch))
                            {
                                int j = 0;
                                while (true)
                                {
                                    ch   = Char.ToLower((char)ch);
                                    w[j] = (char)ch;
                                    if (j < 500)
                                    {
                                        j++;
                                    }
                                    ch = _in.ReadByte();
                                    if (!Char.IsLetter((char)ch))
                                    {
                                        /* to test add(char ch) */
                                        for (int c = 0; c < j; c++)
                                        {
                                            s.add(w[c]);
                                        }
                                        /* or, to test add(char[] w, int j) */
                                        /* s.add(w, j); */
                                        s.stem();

                                        String u;

                                        /* and now, to test toString() : */
                                        u = s.ToString();

                                        /* to test getResultBuffer(), getResultLength() : */
                                        /* u = new String(s.getResultBuffer(), 0, s.getResultLength()); */

                                        Console.Write(u);
                                        break;
                                    }
                                }
                            }
                            if (ch < 0)
                            {
                                break;
                            }
                            Console.Write((char)ch);
                        }
                    }
                    catch (IOException)
                    {
                        Console.WriteLine("error reading " + args[i]);
                        break;
                    }
                }
                catch (FileNotFoundException)
                {
                    Console.WriteLine("file " + args[i] + " not found");
                    break;
                }
            }
        }