public EdgeNGramTokenFilter(TokenStream input,
EdgeNGramTokenFilter.Side side,
int minGram,
int maxGram) {
super(input);
if (side == null) {
throw new IllegalArgumentException("sideLabel must be either front or back");
}
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.side = side;
this.ngrams = new LinkedList();
}
Creates EdgeNGramTokenFilter that can generate n-grams in the sizes of the given range Parameters:
input - TokenStream holding the input to be tokenized
side - the Side from which to chop off an n-gram
minGram - the smallest n-gram to generate
maxGram - the largest n-gram to generate
|
public EdgeNGramTokenFilter(TokenStream input,
String sideLabel,
int minGram,
int maxGram) {
this(input, Side.getSide(sideLabel), minGram, maxGram);
}
Creates EdgeNGramTokenFilter that can generate n-grams in the sizes of the given range Parameters:
input - TokenStream holding the input to be tokenized
sideLabel - the name of the Side from which to chop off an n-gram
minGram - the smallest n-gram to generate
maxGram - the largest n-gram to generate
|