Package org.apache.lucene.analysis

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


   
    HypernymFilter tokenFilter = new HypernymFilter(tokenStream, hypernyms);
   
    Token nextToken = new Token();
    tokenFilter.next(nextToken);   
    assertEquals("token1", nextToken.term());
    assertEquals(0, nextToken.startOffset());
    assertEquals(6, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here


    assertEquals(0, nextToken.startOffset());
    assertEquals(6, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token2", nextToken.term());
    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token21", nextToken.term());
    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token22", nextToken.term());
    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token23", nextToken.term());
    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(6, nextToken.startOffset());
    assertEquals(11, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token3", nextToken.term());
    assertEquals(11, nextToken.startOffset());
    assertEquals(17, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(11, nextToken.startOffset());
    assertEquals(17, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token4", nextToken.term());
    assertEquals(17, nextToken.startOffset());
    assertEquals(23, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(17, nextToken.startOffset());
    assertEquals(23, nextToken.endOffset());
    assertEquals(1, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token41", nextToken.term());
    assertEquals(17, nextToken.startOffset());
    assertEquals(23, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
View Full Code Here

    assertEquals(17, nextToken.startOffset());
    assertEquals(23, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

    nextToken = tokenFilter.next(nextToken);   
    assertEquals("token42", nextToken.term());
    assertEquals(17, nextToken.startOffset());
    assertEquals(23, nextToken.endOffset());
    assertEquals(0, nextToken.getPositionIncrement());

  }
View Full Code Here

      // offset += read;// !!!
      tokenIteractor = tokenCollector.iterator();
    }
    // 返回tokensIteractor下一个Token对象
    Token token = tokenIteractor.next();
    termAtt.setTermBuffer(token.term());
    offsetAtt.setOffset(correctOffset(token.startOffset()),
        correctOffset(token.endOffset()));
    typeAtt.setType("paoding");
    return true;
  }
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.