edu.mit.jmwe.detect
Class InOrder

java.lang.Object
  extended by edu.mit.jmwe.detect.HasMWEDetector
      extended by edu.mit.jmwe.detect.InOrder
All Implemented Interfaces:
IHasMWEDetector, IMWEDetector, IMWEDetectorFilter

public class InOrder
extends HasMWEDetector
implements IMWEDetectorFilter

Filters the output of a given MWE detector, removing those MWEs whose parts appear do not appear in the sentence in the same order as they appear in the MWE description.

Since:
jMWE 1.0.0
Version:
$Id: InOrder.java 598 2011-05-06 03:33:34Z markaf $
Author:
N. Kulkarni

Constructor Summary
InOrder(IMWEDetector d)
          Constructs the detector from the given backing 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.
static
<T extends IToken>
boolean
isOutOfOrder(IMWE<T> mwe)
          Determines if the constituents of the specified MWE are out of order.
 
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

InOrder

public InOrder(IMWEDetector d)
Constructs the detector from the given backing detector.

Parameters:
d - the IMWEDetector that will be used to back this detector. May not be null.
Throws:
NullPointerException - if the backing 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

isOutOfOrder

public static <T extends IToken> boolean isOutOfOrder(IMWE<T> mwe)
Determines if the constituents of the specified MWE are out of order.

Type Parameters:
T - the token type of the MWE
Parameters:
mwe - the MWE in question, may not be null
Returns:
true if the MWE is a problem; false otherwise.
Throws:
NullPointerException - if the specified mwe is null
Since:
jMWE 1.0.0


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