コード例 #1
0
 public override bool incrementToken()
 {
     clearAttributes();
     if (index < testToken.Length)
     {
         termAtt.setEmpty().append(testToken[index++]);
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
            public override bool incrementToken()
            {
                if (input.incrementToken())
                {
                    if (!keywordAttr.Keyword)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String term = termAtt.toString().toLowerCase(java.util.Locale.ROOT);
                        string term = termAtt.ToString().ToLower(Locale.ROOT);
                        termAtt.setEmpty().append(term);
                    }
                    return(true);
                }
                return(false);
            }
コード例 #3
0
        /// <summary>
        /// Returns the next, stemmed, input Token. </summary>
        ///  <returns> The stemmed form of a token. </returns>
        ///  <exception cref="IOException"> If there is a low-level I/O error. </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
        public override bool incrementToken()
        {
            if (!input.incrementToken())
            {
                return(false);
            }

            char[] term = termAttribute.buffer();
            int    len  = termAttribute.length();

            if ((!keywordAtt.Keyword) && stemmer.stem(term, len))
            {
                termAttribute.setEmpty().append(stemmer.asCharSequence());
            }

            return(true);
        }
コード例 #4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
        public override bool incrementToken()
        {
            if (!input.incrementToken())
            {
                return(false);
            }

            m.reset();
            if (m.find())
            {
                // replaceAll/replaceFirst will reset() this previous find.
                string transformed = all ? m.replaceAll(replacement) : m.replaceFirst(replacement);
                termAtt.setEmpty().append(transformed);
            }

            return(true);
        }
コード例 #5
0
        /// <returns>  Returns true for next token in the stream, or false at EOS </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public boolean incrementToken() throws java.io.IOException
        public override bool incrementToken()
        {
            if (input.incrementToken())
            {
                string term = termAtt.ToString();

                if (!keywordAttr.Keyword)
                {
                    string s = stemmer.stem(term);
                    // If not stemmed, don't waste the time adjusting the token.
                    if ((s != null) && !s.Equals(term))
                    {
                        termAtt.setEmpty().append(s);
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }