public class ConstrainLength extends FilterByScore
Modifier and Type | Field and Description |
---|---|
protected boolean |
isMaxLength |
protected int |
length |
Constructor and Description |
---|
ConstrainLength(IMWEDetector detector,
int length,
boolean isMaxLength)
Construct a new filter on top of the specified detector
|
Modifier and Type | Method and Description |
---|---|
protected <T extends IToken> |
getScorer(java.util.List<T> sentence)
Returns a scoring function for the specified sentence.
|
protected boolean |
isGoodScore(double score)
Returns
true if the score passes the filter (i.e., the
scored MWE should be kept); false otherwise |
detect
getWrappedDetector
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWrappedDetector
public ConstrainLength(IMWEDetector detector, int length, boolean isMaxLength)
detector
- the wrapped detector; may not be null
length
- the length limit; either max or min depending on the
isMaxLength
flagisMaxLength
- true
if the all MWEs with lengths greater than
the specified length are to be discarded; false
otherwisejava.lang.NullPointerException
- if the detector is null
protected boolean isGoodScore(double score)
FilterByScore
true
if the score passes the filter (i.e., the
scored MWE should be kept); false
otherwiseisGoodScore
in class FilterByScore
score
- the score to be checkedtrue
if the score passes the filter (i.e., the
scored MWE should be kept); false
otherwiseprotected <T extends IToken> IScorer<IMWE<T>> getScorer(java.util.List<T> sentence)
FilterByScore
getScorer
in class FilterByScore
T
- the type of token in the sentencesentence
- the sentence for which the scorer should be constructedCopyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.