Examples of termBuffer()


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

    TokenStream stream = new IterTokenStream("Kuczewski");
    TokenStream filter = new DoubleMetaphoneFilter(stream, 4, false);

    Token token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KSSK", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KXFS", new String(token.termBuffer(), 0, token.termLength()));
    assertNull(filter.next(new Token()));
View Full Code Here

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

    assertEquals(4, token.termLength());
    assertEquals("KSSK", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("KXFS", new String(token.termBuffer(), 0, token.termLength()));
    assertNull(filter.next(new Token()));
  }

  public void testSize8FalseInject() throws Exception {
    TokenStream stream = new IterTokenStream("international");
View Full Code Here

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

    TokenStream stream = new IterTokenStream("international");
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, false);

    Token token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("ANTRNXNL", new String(token.termBuffer(), 0, token
        .termLength()));

    assertNull(filter.next(new Token()));
  }
View Full Code Here

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

        new String[] { "12345", "#$%@#^%&" });
    TokenStream filter = new DoubleMetaphoneFilter(stream, 8, true);

    Token token = filter.next(new Token());
    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
        .termLength()));
View Full Code Here

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

    assertEquals(5, token.termLength());
    assertEquals("12345", new String(token.termBuffer(), 0, token.termLength()));

    token = filter.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("#$%@#^%&", new String(token.termBuffer(), 0, token
        .termLength()));
  }

  public void testNonConvertableStringsWithoutInject() throws Exception {
    TokenStream stream = new IterTokenStream(
View Full Code Here

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

    assertEquals(DoubleMetaphoneFilter.class, filteredStream.getClass());

    Token token = filteredStream.next(new Token());
    assertEquals(13, token.termLength());
    assertEquals("international", new String(token.termBuffer(), 0, token
        .termLength()));

    token = filteredStream.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("ANTR", new String(token.termBuffer(), 0, token.termLength()));
View Full Code Here

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

    assertEquals("international", new String(token.termBuffer(), 0, token
        .termLength()));

    token = filteredStream.next(new Token());
    assertEquals(4, token.termLength());
    assertEquals("ANTR", new String(token.termBuffer(), 0, token.termLength()));

    assertNull(filteredStream.next(new Token()));
  }

  public void testSettingSizeAndInject() throws Exception {
View Full Code Here

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

    assertEquals(DoubleMetaphoneFilter.class, filteredStream.getClass());

    Token token = filteredStream.next(new Token());
    assertEquals(8, token.termLength());
    assertEquals("ANTRNXNL", new String(token.termBuffer(), 0, token
        .termLength()));

    assertNull(filteredStream.next(new Token()));
  }
}
View Full Code Here

Examples of org.apache.lucene.analysis.tokenattributes.TermAttribute.termBuffer()

    TermAttribute termAtt = (TermAttribute) result
        .addAttribute(TermAttribute.class);
    StringBuilder buf = new StringBuilder();
    try {
      while (result.incrementToken()) {
        String word = new String(termAtt.termBuffer(), 0, termAtt
            .termLength());
        buf.append(filter.encode(word)).append(" ");
       
      }
    } catch (IOException e) {
View Full Code Here

Examples of org.apache.lucene.analysis.tokenattributes.TermAttribute.termBuffer()

    TokenStream ts = analyzer.tokenStream("body", in);
    TermAttribute termAtt = ts.addAttribute(TermAttribute.class);

    Vector v1 = new RandomAccessSparseVector(100);                  
    while (ts.incrementToken()) {
      char[] termBuffer = termAtt.termBuffer();
      int termLen = termAtt.termLength();
      String w = new String(termBuffer, 0, termLen);                
      encoder.addToVector(w, 1, v1);                                
    }
    System.out.printf("%s\n", new SequentialAccessSparseVector(v1));
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.