edu.mit.jmwe.detect
Class ResolveByScore

java.lang.Object
  extended by edu.mit.jmwe.detect.HasMWEDetector
      extended by edu.mit.jmwe.detect.ResolveByScore
All Implemented Interfaces:
IHasMWEDetector, IMWEDetector, IMWEDetectorResolver
Direct Known Subclasses:
Leftmost, Longest, SmallestVariance

public abstract class ResolveByScore
extends HasMWEDetector
implements IMWEDetectorResolver

Abstract base class for MWE detector resolvers that use a simple score to resolve conflicts.

Since:
jMWE 1.0.0
Version:
$Id: ResolveByScore.java 620 2011-05-08 21:13:58Z markaf $
Author:
M.A. Finlayson

Field Summary
protected  boolean chooseLargest
           
 
Constructor Summary
ResolveByScore(IMWEDetector detector, boolean chooseLargest)
          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 the scoring function for this filter.
 
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
 

Field Detail

chooseLargest

protected final boolean chooseLargest
Constructor Detail

ResolveByScore

public ResolveByScore(IMWEDetector detector,
                      boolean chooseLargest)
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

getScorer

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

Type Parameters:
T - they type of the token
Parameters:
sentence - the sentence to be scored
Returns:
the scorer
Since:
jMWE 1.0.0


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