org.apache.lucene.analysis.ngram
Class EdgeNGramTokenizer

java.lang.Object
  extended by org.apache.lucene.util.AttributeSource
      extended by org.apache.lucene.analysis.TokenStream
          extended by org.apache.lucene.analysis.Tokenizer
              extended by org.apache.lucene.analysis.ngram.NGramTokenizer
                  extended by org.apache.lucene.analysis.ngram.EdgeNGramTokenizer
All Implemented Interfaces:
Closeable

public class EdgeNGramTokenizer
extends NGramTokenizer

Tokenizes the input from an edge into n-grams of given size(s).

This Tokenizer create n-grams from the beginning edge or ending edge of a input token.

As of Lucene 4.4, this tokenizer

Although highly discouraged, it is still possible to use the old behavior through Lucene43EdgeNGramTokenizer.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.util.AttributeSource
AttributeSource.AttributeFactory, AttributeSource.State
 
Field Summary
static int DEFAULT_MAX_GRAM_SIZE
           
static int DEFAULT_MIN_GRAM_SIZE
           
 
Fields inherited from class org.apache.lucene.analysis.ngram.NGramTokenizer
DEFAULT_MAX_NGRAM_SIZE, DEFAULT_MIN_NGRAM_SIZE
 
Fields inherited from class org.apache.lucene.analysis.Tokenizer
input
 
Constructor Summary
EdgeNGramTokenizer(Version version, AttributeSource.AttributeFactory factory, Reader input, int minGram, int maxGram)
          Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range
EdgeNGramTokenizer(Version version, Reader input, int minGram, int maxGram)
          Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range
 
Method Summary
 
Methods inherited from class org.apache.lucene.analysis.ngram.NGramTokenizer
end, incrementToken, isTokenChar, reset
 
Methods inherited from class org.apache.lucene.analysis.Tokenizer
close, correctOffset, setReader
 
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, equals, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, hashCode, reflectAsString, reflectWith, restoreState, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MAX_GRAM_SIZE

public static final int DEFAULT_MAX_GRAM_SIZE
See Also:
Constant Field Values

DEFAULT_MIN_GRAM_SIZE

public static final int DEFAULT_MIN_GRAM_SIZE
See Also:
Constant Field Values
Constructor Detail

EdgeNGramTokenizer

public EdgeNGramTokenizer(Version version,
                          Reader input,
                          int minGram,
                          int maxGram)
Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range

Parameters:
version - the Lucene match version
input - Reader holding the input to be tokenized
minGram - the smallest n-gram to generate
maxGram - the largest n-gram to generate

EdgeNGramTokenizer

public EdgeNGramTokenizer(Version version,
                          AttributeSource.AttributeFactory factory,
                          Reader input,
                          int minGram,
                          int maxGram)
Creates EdgeNGramTokenizer that can generate n-grams in the sizes of the given range

Parameters:
version - the Lucene match version
factory - AttributeSource.AttributeFactory to use
input - Reader holding the input to be tokenized
minGram - the smallest n-gram to generate
maxGram - the largest n-gram to generate


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.