edu.mit.jmwe.detect
Class FilterByScore

java.lang.Object
  extended by edu.mit.jmwe.detect.HasMWEDetector
      extended by edu.mit.jmwe.detect.FilterByScore
All Implemented Interfaces:
IHasMWEDetector, IMWEDetector, IMWEDetectorFilter
Direct Known Subclasses:
ConstrainLength, LeskAtLeast, MoreFrequentAsMWE

public abstract class FilterByScore
extends HasMWEDetector
implements IMWEDetectorFilter

Removes all MWEs from the wrapped detector's results whose score is "no good", where "no good" is implementation dependent.

Since:
jMWE 1.0.0
Version:
$Id: FilterByScore.java 598 2011-05-06 03:33:34Z markaf $
Author:
M.A. Finlayson

Constructor Summary
FilterByScore(IMWEDetector detector)
          Constructs a new MWE detector constraint that wraps the specified MWE Detector.
 
Method Summary
<T extends IToken>
List<IMWE<T>>
detect(List<T> sentence)
          Given a list of tokens, the detector searches for the MWEs in the list.
protected abstract
<T extends IToken>
IScorer<IMWE<T>>
getScorer(List<T> sentence)
          Returns a scoring function for the specified sentence.
protected abstract  boolean isGoodScore(double score)
          Returns true if the score passes the filter (i.e., the scored MWE should be kept); false otherwise
 
Methods inherited from class edu.mit.jmwe.detect.HasMWEDetector
getWrappedDetector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.mit.jmwe.detect.IHasMWEDetector
getWrappedDetector
 

Constructor Detail

FilterByScore

public FilterByScore(IMWEDetector detector)
Constructs a new MWE detector constraint that wraps the specified MWE Detector.

Parameters:
detector - the detector wrapped by this object
Throws:
NullPointerException - if the specified detector is null
Since:
jMWE 1.0.0
Method Detail

detect

public <T extends IToken> List<IMWE<T>> detect(List<T> sentence)
Description copied from interface: IMWEDetector
Given a list of tokens, the detector searches for the MWEs in the list. It returns a set of IMWE objects representing these multi-word expressions. The method returns an empty list if no MWEs are found; the method should never return null.

Specified by:
detect in interface IMWEDetector
Overrides:
detect in class HasMWEDetector
Type Parameters:
T - the type of the tokens in the sentence
Parameters:
sentence - a sentence which the detector should search for multi-word expressions.
Returns:
a list of IMWE objects representing the multi-word expressions found in the sentence. Returns an empty list if no multi-word expressions are found; never returns null

isGoodScore

protected abstract boolean isGoodScore(double score)
Returns true if the score passes the filter (i.e., the scored MWE should be kept); false otherwise

Parameters:
score - the score to be checked
Returns:
true if the score passes the filter (i.e., the scored MWE should be kept); false otherwise
Since:
jMWE 1.0.0

getScorer

protected abstract <T extends IToken> IScorer<IMWE<T>> getScorer(List<T> sentence)
Returns a scoring function for the specified sentence.

Type Parameters:
T - the type of token in the sentence
Parameters:
sentence - the sentence for which the scorer should be constructed
Returns:
a scorer for MWEs in the specified sentence
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.