コード例 #1
0
 public PorterStemFilter(TokenStream in_Renamed) : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
 }
コード例 #2
0
 public PorterStemFilter(TokenStream in_Renamed) : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
     termAtt = (TermAttribute)AddAttribute(typeof(TermAttribute));
 }
コード例 #3
0
 public PorterStemFilter(TokenStream in_Renamed)
     : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
     termAtt = AddAttribute<ITermAttribute>();
 }
コード例 #4
0
 public PorterStemFilter(TokenStream in_Renamed)
     : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
 }
コード例 #5
0
ファイル: PorterStemmer.cs プロジェクト: Cefa68000/lucenenet
        public static void Main(System.String[] args)
        {
            var s = new PorterStemmer();

            for (int i = 0; i < args.Length; i++)
            {
                try
                {
                    System.IO.Stream in_Renamed = new System.IO.FileStream(args[i], System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    var buffer = new byte[1024];

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

                    while (true)
                    {
                        int ch;
                        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 (Char.IsLetter((char) ch))
                        {
                            s.Add(Char.ToLower((char) ch));
                        }
                        else
                        {
                            s.Stem();
                            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)
                {
                    Console.Out.WriteLine("error reading " + args[i]);
                }
            }
        }
コード例 #6
0
        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]);
                }
            }
        }
コード例 #7
0
ファイル: PorterStemFilter.cs プロジェクト: sinsay/SSE
 public PorterStemFilter(TokenStream in_Renamed)
     : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
     termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
 }
コード例 #8
0
 public PorterStemFilter(TokenStream in_Renamed) : base(in_Renamed)
 {
     stemmer = new PorterStemmer();
     termAtt = AddAttribute <ITermAttribute>();
 }