public class TokenLengthTokenizerFactory extends ModifyTokenTokenizerFactory implements Serializable
TokenLengthTokenizerFactory filters the tokenizers produced
by a base tokenizer to only return tokens between specified lower and
upper length limits.
| Constructor and Description |
|---|
TokenLengthTokenizerFactory(TokenizerFactory factory,
int shortestTokenLength,
int longestTokenLength)
Construct a token-length filtered tokenizer factory from the
specified factory that removes tokens shorter than the shortest
or longer than the longest length.
|
| Modifier and Type | Method and Description |
|---|---|
String |
modifyToken(String token)
Return a tokenizer that filters out any tokens produced by the specified
tokenizer that are shorter than the shortest or longer than the longest
acceptable lengths.
|
String |
toString() |
modify, modifyWhitespacebaseTokenizerFactory, tokenizerpublic TokenLengthTokenizerFactory(TokenizerFactory factory, int shortestTokenLength, int longestTokenLength)
Integer.MIN_VALUE and Integer.MAX_VALUE.factory - Base tokenizer factory.shortestTokenLength - Length of shortest acceptable token.longestTokenLength - Length of longest acceptable token.IllegalArgumentException - If the shortest length is negative, or
the shortest length is greater than the longest length.public String modifyToken(String token)
modifyToken in class ModifyTokenTokenizerFactorytoken - Input token.null otherwise.public String toString()
toString in class ModifyTokenTokenizerFactoryCopyright © 2016 Alias-i, Inc.. All rights reserved.