public class TermLengthFilter extends AbstractSingleTermFilter
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAXIMUM_LENGTH
The default maximum length is 28.
|
static int |
DEFAULT_MINIMUM_LENGTH
The default minimum length is 3.
|
protected java.lang.Integer |
maximumLength
The maximum allowed length.
|
protected java.lang.Integer |
minimumLength
The minimum allowed length.
|
Constructor and Description |
---|
TermLengthFilter()
Creates a new
TermLengthFilter with default minimum and
maximum values. |
TermLengthFilter(java.lang.Integer minimumLength,
java.lang.Integer maximumLength)
Creates a new
TermLengthFilter with given minimum and maximum
values. |
Modifier and Type | Method and Description |
---|---|
TermOccurrence |
filterTerm(TermOccurrence occurrence)
Takes a single term occurrence and filters that occurrence into a new
occurrence or returns null, indicating that the filter rejects that
term.
|
java.lang.Integer |
getMaximumLength()
Gets the maximum length allowed for a term (inclusive).
|
java.lang.Integer |
getMinimumLength()
Gets the minimum length allowed for a term (inclusive).
|
void |
setMaximumLength(java.lang.Integer maximumLength)
Gets the maximum length allowed for a term (inclusive).
|
void |
setMinimumLength(java.lang.Integer minimumLength)
Gets the minimum length allowed for a term (inclusive).
|
filterTerms
clone
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone
public static final int DEFAULT_MINIMUM_LENGTH
@PublicationReference(author="Wikipedia", title="Longest word in English", year=2009, type=WebPage, url="http://en.wikipedia.org/wiki/Longest_word_in_English") public static final int DEFAULT_MAXIMUM_LENGTH
protected java.lang.Integer minimumLength
protected java.lang.Integer maximumLength
public TermLengthFilter()
TermLengthFilter
with default minimum and
maximum values.public TermLengthFilter(java.lang.Integer minimumLength, java.lang.Integer maximumLength)
TermLengthFilter
with given minimum and maximum
values.minimumLength
- The minimum allowed term length.maximumLength
- The maximum allowed term length.public TermOccurrence filterTerm(TermOccurrence occurrence)
SingleTermFilter
occurrence
- The term occurrence to filter.public java.lang.Integer getMinimumLength()
public void setMinimumLength(java.lang.Integer minimumLength)
minimumLength
- The minimum length allowed for a term. Must be non-negative.public java.lang.Integer getMaximumLength()
public void setMaximumLength(java.lang.Integer maximumLength)
maximumLength
- The maximum length allowed for a term. Must be positive.