|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.detect.HasMWEDetector
edu.mit.jmwe.detect.LMLR
public class LMLR
Stands for "Longest Match, Left to Right". A detector that resolves conflicts in the results of its backing detector by returning the MWE that started the earliest in the sentence. If the conflicting MWEs started at the same position, returns the longer of them.
Constructor Summary | |
---|---|
LMLR(IMWEDetector detector)
Constructs the detector from the backing detector. |
Method Summary | ||
---|---|---|
|
detect(List<T> s)
Given a list of tokens, the detector searches for the MWEs in the list. |
|
static
|
getFirstToken(Iterable<? extends T> tokens,
Comparator<T> c)
Returns the token that is the first in a given iterable collection of tokens. |
|
static
|
longest(IMWE<T> one,
IMWE<T> two,
Comparator<T> c)
Compares two MWEs and returns the longest 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 |
---|
public LMLR(IMWEDetector detector)
null
.
detector
- the detector used to back this detector.Method Detail |
---|
public <T extends IToken> List<IMWE<T>> detect(List<T> s)
IMWEDetector
IMWE
objects representing these
multi-word expressions. The method returns an empty list if no MWEs are
found; the method should never return null
.
detect
in interface IMWEDetector
detect
in class HasMWEDetector
T
- the type of the tokens in the sentences
- a sentence which the detector should search for multi-word
expressions.
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
public static <T extends IToken> T getFirstToken(Iterable<? extends T> tokens, Comparator<T> c)
T
- the type of tokens being comparedtokens
- the tokens being comparedc
- the comparator used to determine if one token comes before
another
public static <T extends IToken> IMWE<T> longest(IMWE<T> one, IMWE<T> two, Comparator<T> c)
T
- the type of tokens in the MWEone
- the first MWEtwo
- the second MWE
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |