edu.mit.jmwe.detect
Class CompositeDetector
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<IMWEDetector>
edu.mit.jmwe.detect.CompositeDetector
- All Implemented Interfaces:
- IMWEDetector, Iterable<IMWEDetector>, Collection<IMWEDetector>, List<IMWEDetector>
- Direct Known Subclasses:
- Baseline, TrulyExhaustive
public class CompositeDetector
- extends AbstractList<IMWEDetector>
- implements IMWEDetector
A detector composed of multiple simpler detectors.
- Since:
- jMWE 1.0.0
- Version:
- $Id: CompositeDetector.java 610 2011-05-06 20:05:20Z markaf $
- Author:
- N. Kulkarni, M.A. Finlayson
Method Summary |
|
detect(List<T> sentence)
Given a list of tokens, the detector searches for the MWEs in the list. |
IMWEDetector |
get(int index)
|
int |
size()
|
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
CompositeDetector
public CompositeDetector(IMWEDetector... ds)
- Constructs a composite detector from an array of detectors. The array of
detectors should be ordered by descending preference. The most preferred
detector should be first, the second-most-preferred second, etc. If there
is a conflict between multi-word expressions found by two detectors, the
multi-word expression found by the more-preferred detector will be
chosen.
- Parameters:
ds
- the array of detectors in order of descending preference. May
not be null
. May not contain any null
detectors.
- Throws:
NullPointerException
- if the specified array is null
or if any of the detectors
in the list are null
.- Since:
- jMWE 1.0.0
CompositeDetector
public CompositeDetector(List<? extends IMWEDetector> ds)
- Constructs a composite detector from a list of detectors. The list of
detectors should be ordered by descending preference. The most preferred
detector should be first, the second-most-preferred second, etc. If there
is a conflict between multi-word expressions found by two detectors, the
multi-word expression found by the more-preferred detector will be
chosen.
- Parameters:
ds
- the list of detectors in order of descending preference. May
not be null
. May not contain any null
detectors.
- Throws:
NullPointerException
- if the specified list is null
or if any of the detectors
in the list are null
.- Since:
- jMWE 1.0.0
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
- 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
get
public IMWEDetector get(int index)
- Specified by:
get
in interface List<IMWEDetector>
- Specified by:
get
in class AbstractList<IMWEDetector>
size
public int size()
- Specified by:
size
in interface Collection<IMWEDetector>
- Specified by:
size
in interface List<IMWEDetector>
- Specified by:
size
in class AbstractCollection<IMWEDetector>
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.