public static void  Main(System.String[] args)
		{
			PorterStemmer s = new PorterStemmer();
			
			for (int i = 0; i < args.Length; i++)
			{
				try
				{
					System.IO.BinaryReader in_Renamed = new System.IO.BinaryReader(System.IO.File.Open(args[i], System.IO.FileMode.Open, System.IO.FileAccess.Read));
					byte[] buffer = new byte[1024];
					int bufferLen, offset, ch;
					
					bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
					offset = 0;
					s.Reset();
					
					while (true)
					{
						if (offset < bufferLen)
							ch = buffer[offset++];
						else
						{
							bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
							offset = 0;
							if (bufferLen <= 0)
								ch = - 1;
							else
								ch = buffer[offset++];
						}
						
						if (System.Char.IsLetter((char) ch))
						{
							s.Add(System.Char.ToLower((char) ch));
						}
						else
						{
							s.Stem();
							System.Console.Out.Write(s.ToString());
							s.Reset();
							if (ch < 0)
								break;
							else
							{
								System.Console.Out.Write((char) ch);
							}
						}
					}
					
					in_Renamed.Close();
				}
				catch (System.IO.IOException )
				{
					System.Console.Out.WriteLine("error reading " + args[i]);
				}
			}
		}
        public static void  Main(System.String[] args)
        {
            PorterStemmer s = new PorterStemmer();

            for (int i = 0; i < args.Length; i++)
            {
                try
                {
                    System.IO.BinaryReader in_Renamed = new System.IO.BinaryReader(System.IO.File.Open(args[i], System.IO.FileMode.Open, System.IO.FileAccess.Read));
                    byte[] buffer = new byte[1024];
                    int    bufferLen, offset, ch;

                    bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
                    offset    = 0;
                    s.Reset();

                    while (true)
                    {
                        if (offset < bufferLen)
                        {
                            ch = buffer[offset++];
                        }
                        else
                        {
                            bufferLen = in_Renamed.Read(buffer, 0, buffer.Length);
                            offset    = 0;
                            if (bufferLen <= 0)
                            {
                                ch = -1;
                            }
                            else
                            {
                                ch = buffer[offset++];
                            }
                        }

                        if (System.Char.IsLetter((char)ch))
                        {
                            s.Add(System.Char.ToLower((char)ch));
                        }
                        else
                        {
                            s.Stem();
                            System.Console.Out.Write(s.ToString());
                            s.Reset();
                            if (ch < 0)
                            {
                                break;
                            }
                            else
                            {
                                System.Console.Out.Write((char)ch);
                            }
                        }
                    }

                    in_Renamed.Close();
                }
                catch (System.IO.IOException)
                {
                    System.Console.Out.WriteLine("error reading " + args[i]);
                }
            }
        }
 public PorterStemFilter(TokenStream in_Renamed) : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
 }
Exemplo n.º 4
0
		public PorterStemFilter(TokenStream in_Renamed) : base(in_Renamed)
		{
			stemmer = new PorterStemmer();
		}