edu.mit.jmwe.detect
Class Consecutive

java.lang.Object
  extended by edu.mit.jmwe.index.HasMWEIndex
      extended by edu.mit.jmwe.detect.Consecutive
All Implemented Interfaces:
IMWEDetector, IHasMWEIndex

public class Consecutive
extends HasMWEIndex
implements IMWEDetector

Detector that uses an index to detect the MWEs whose parts appear continuously in the sentence.

Since:
jMWE 1.0.0
Version:
$Id: Consecutive.java 608 2011-05-06 19:32:34Z markaf $
Author:
M.A. Finlayson

Constructor Summary
Consecutive(IMWEIndex index)
          Constructs the detector from the given index.
 
Method Summary
<T extends IToken>
List<IMWE<T>>
detect(List<T> sent)
          Given a list of tokens, the detector searches for the MWEs in the list.
protected
<T extends IToken>
boolean
fillNextSlot(MWEBuilder<T> builder, T t)
          Fills the first non-null (empty) slot in the given builder.
protected  Set<? extends IMWEDesc> getMWEDescs(IToken token)
          Returns all the MWE entries in the index that contain the given token or one of its stems as a part.
 
Methods inherited from class edu.mit.jmwe.index.HasMWEIndex
getMWEIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Consecutive

public Consecutive(IMWEIndex index)
Constructs the detector from the given index.

Parameters:
index - the index to be used when searching for MWEs. May not be null.
Since:
jMWE 1.0.0
Method Detail

detect

public <T extends IToken> List<IMWE<T>> detect(List<T> sent)
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
Type Parameters:
T - the type of the tokens in the sentence
Parameters:
sent - 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

fillNextSlot

protected <T extends IToken> boolean fillNextSlot(MWEBuilder<T> builder,
                                                  T t)
Fills the first non-null (empty) slot in the given builder. Each slot can be filled by a token that matches the part. Returns true if the slot can be filled, false otherwise.

Parameters:
builder - the builder to be filled
t - the token to fill the builder's next open slot with
Returns:
true if the next open slot can be filled, false otherwise.
Since:
jMWE 1.0.0

getMWEDescs

protected Set<? extends IMWEDesc> getMWEDescs(IToken token)
Returns all the MWE entries in the index that contain the given token or one of its stems as a part. If no entries are found, returns an empty set.

Parameters:
token - the token to be looked up in the index
Returns:
a possibly empty set of MWE descriptions in the index that contain the given token or a stem as a part.
Since:
jMWE 1.0.0


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