T
- the type of token for this comparatorpublic class MWEComparator<T extends IToken> extends AbstractIndexComparator<T,IMWE<T>>
IMWE
s by checking which MWE starts earlier
in the list of tokens used to construct this comparator. If the two MWEs have
the same tokens, uses the part of speech to determine the order.indexMap
Constructor and Description |
---|
MWEComparator(java.util.List<T> list)
Constructs the comparator from the given list of tokens by mapping each
token in the list to its index in the list.
|
MWEComparator(java.util.Map<T,java.lang.Integer> indexMap)
Constructs the comparator from the given index map of each token in a
list to its index in the list.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(IMWE<T> one,
IMWE<T> two) |
protected boolean |
earlier(IMWE<T> one,
IMWE<T> two)
Internal method used to determine if one multi-word expression appears in
the sentence before another.
|
createIndexMap, getIndexMap
public MWEComparator(java.util.List<T> list)
list
- the list of objects used to construct this comparator. May not
be null
.java.lang.NullPointerException
- if the given list is null
.public MWEComparator(java.util.Map<T,java.lang.Integer> indexMap)
indexMap
- map of each token in a list to its index in the list. May not
be null
.protected boolean earlier(IMWE<T> one, IMWE<T> two)
one
- multi-word expression being comparedtwo
- multi-word expression being comparedtrue
if one is before two
false
otherwise.Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.