public NGramTokenFilter(TokenStream input,
int minGram,
int maxGram) {
super(input);
if (minGram < 1) {
throw new IllegalArgumentException("minGram must be greater than zero");
}
if (minGram > maxGram) {
throw new IllegalArgumentException("minGram must not be greater than maxGram");
}
this.minGram = minGram;
this.maxGram = maxGram;
this.ngrams = new LinkedList();
}
Creates NGramTokenFilter with given min and max n-grams. Parameters:
input - TokenStream holding the input to be tokenized
minGram - the smallest n-gram to generate
maxGram - the largest n-gram to generate
|