Beispiel #1
0
        /// <summary>Returns the next input Token, after being stemmed </summary>
        public override Token Next()
        {
            Token token = input.Next();

            if (token == null)
            {
                return(null);
            }
            stemmer.SetCurrent(token.TermText());
            try
            {
                stemMethod.Invoke(stemmer, (System.Object[])EMPTY_ARGS);
            }
            catch (System.Exception e)
            {
                throw new System.SystemException(e.ToString());
            }

            Token newToken = new Token(stemmer.GetCurrent(), token.StartOffset(), token.EndOffset(), token.Type());

            newToken.SetPositionIncrement(token.GetPositionIncrement());
            return(newToken);
        }
Beispiel #2
0
 /// <summary>Returns the next input Token, after being stemmed </summary>
 public sealed override bool IncrementToken()
 {
     if (input.IncrementToken())
     {
         String originalTerm = termAtt.Term;
         stemmer.SetCurrent(originalTerm);
         stemmer.Stem();
         String finalTerm = stemmer.GetCurrent();
         // Don't bother updating, if it is unchanged.
         if (!originalTerm.Equals(finalTerm))
         {
             termAtt.SetTermBuffer(finalTerm);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }