示例#1
0
        protected internal override bool incrementWord()
        {
            int start = wordBreaker.current();

            if (start == BreakIterator.DONE)
            {
                return(false);  // BreakIterator exhausted
            }

            // find the next set of boundaries, skipping over non-tokens
            int end_Renamed = wordBreaker.next();

            while (end_Renamed != BreakIterator.DONE && !char.IsLetterOrDigit(char.codePointAt(buffer, sentenceStart + start, sentenceEnd)))
            {
                start       = end_Renamed;
                end_Renamed = wordBreaker.next();
            }

            if (end_Renamed == BreakIterator.DONE)
            {
                return(false);  // BreakIterator exhausted
            }

            clearAttributes();
            termAtt.copyBuffer(buffer, sentenceStart + start, end_Renamed - start);
            offsetAtt.setOffset(correctOffset(offset + sentenceStart + start), correctOffset(offset + sentenceStart + end_Renamed));
            return(true);
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public final boolean incrementToken() throws java.io.IOException
        public override bool incrementToken()
        {
            if (!input.incrementToken())
            {
                return(false);
            }

            if ((!keywordAttr.Keyword) && stemmer.stem(termAtt.buffer(), 0, termAtt.length()))
            {
                termAtt.copyBuffer(stemmer.ResultBuffer, 0, stemmer.ResultLength);
            }
            return(true);
        }