edu.mit.jmwe.detect
Class Continuous

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

public class Continuous
extends HasMWEDetector
implements IMWEDetectorFilter

A detector that filters the results of its backing detector to return only those MWEs whose parts are continuous in the sentence.

Since:
jMWE 1.0.0
Version:
$Id: Continuous.java 599 2011-05-06 03:53:23Z markaf $
Author:
N. Kulkarni, M.A. Finlayson

Constructor Summary
Continuous(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
isDiscontinuous(IMWE<T> mwe, List<T> sentence)
          Determines if the specified MWE is continuous, i.e., there are no interstitial tokens inside its boundaries that are not a part of the MWE.
static
<T extends IToken>
boolean
isDiscontinuous(IMWE<T> mwe, Map<T,Integer> indexMap)
          Determines if the specified MWE is continuous, i.e., there are no interstitial tokens inside its boundaries that are not a part of the MWE.
 
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

Continuous

public Continuous(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

isDiscontinuous

public static <T extends IToken> boolean isDiscontinuous(IMWE<T> mwe,
                                                         List<T> sentence)
Determines if the specified MWE is continuous, i.e., there are no interstitial tokens inside its boundaries that are not a part of the MWE.

Type Parameters:
T - the token type of the MWE
Parameters:
mwe - the MWE in question, may not be null
sentence - the sentence from which the MWE is drawn
Returns:
true if the MWE is continuous; false otherwise.
Throws:
NullPointerException - if the specified mwe is null, or does not come from the specified sentence
Since:
jMWE 1.0.0

isDiscontinuous

public static <T extends IToken> boolean isDiscontinuous(IMWE<T> mwe,
                                                         Map<T,Integer> indexMap)
Determines if the specified MWE is continuous, i.e., there are no interstitial tokens inside its boundaries that are not a part of the MWE.

Type Parameters:
T - the token type of the MWE
Parameters:
mwe - the MWE in question, may not be null
indexMap - a map from sentence tokens to their index in the sentence
Returns:
true if the MWE is continuous; false otherwise.
Throws:
NullPointerException - if the specified mwe is null
Since:
jMWE 1.0.0


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