Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.Token.clone()


      if (expansions == null) {
        return nextRealToken;
      }
      st = new StringTokenizer(expansions, ",");
      if (st.hasMoreTokens()) {
        currentRealToken = (Token) nextRealToken.clone();
      }
      return currentRealToken;
    } else {
      reusableToken.reinit(st.nextToken(),
                           currentRealToken.startOffset(),
View Full Code Here


                  if (!it.hasNext()) {
                    return null;
                  }
                  // Resettable token streams need to return clones.
                  Token nextToken = (Token) it.next();
                  return (Token) nextToken.clone();
                }

                public void reset() throws IOException {
                  it = tokens.iterator();
                }
View Full Code Here

        Token nextToken = input.next(reusableToken);
        if (nextToken == null) {
          prevToken = null;
          return null;
        }
        prevToken = (Token) nextToken.clone();
        String text = nextToken.term();
        if (text.equals("triplemulti")) {
          multiToken = 2;
          return nextToken;
        } else if (text.equals("multi")) {
View Full Code Here

      }
      if (!iterator.hasNext()) {
        return null;
      }
      Token nextToken = (Token) iterator.next();
      return (Token) nextToken.clone();
    }


    public void reset() throws IOException {
      iterator = null;
View Full Code Here

    if (UnicodeBlock.of(text.charAt(0)) != UnicodeBlock.THAI) {
      nextToken.setTermBuffer(text.toLowerCase());
      return nextToken;
    }

    thaiToken = (Token) nextToken.clone();
    breaker.setText(text);
    int end = breaker.next();
    if (end != BreakIterator.DONE) {
      nextToken.setTermBuffer(text, 0, end);
      nextToken.setEndOffset(nextToken.startOffset() + end);
View Full Code Here

    /*
     * Push new tokens to the output buffer.
     */
    if (!shingleBuf.isEmpty()) {
      Token firstShingle = (Token) shingleBuf.get(0);
      shingle = (Token) firstShingle.clone();
      shingle.setType(tokenType);
    }
    for (int j = 1; j < shingleBuf.size(); j++) {
      shingle.setEndOffset(endOffsets[j]);
      StringBuffer buf = shingles[j];
View Full Code Here

          TokenStream tokenStream = new TokenFilter(child.tokenStream(fieldName, reader)) {

            public Token next(final Token reusableToken) throws IOException {
              assert reusableToken != null;
              Token nextToken = input.next(reusableToken); // from filter super class
              if (nextToken != null) tokens2.add(nextToken.clone());
              return nextToken;
            }
          };
         
          cache.put(fieldName, tokens2);
View Full Code Here

    if (nextToken == null) return null; // EOS; iterator exhausted
   
    stack = synonyms.getSynonyms(nextToken.term()); // push onto stack
    if (stack.length > maxSynonyms) randomize(stack);
    index = 0;
    current = (Token) nextToken.clone();
    todo = maxSynonyms;
    return nextToken;
  }
 
  /**
 
View Full Code Here

      Token token = stream.next( reusableToken );
      if ( token == null ) {
        break;
      }

      tokenList.add( ( Token ) token.clone() );
    }

    return tokenList.toArray( new Token[tokenList.size()] );
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.