T - type of IToken objects that form the multi-word expressionpublic class MWE<T extends IToken> extends java.lang.Object implements IMWE<T>
IMWE interface.| Constructor and Description |
|---|
MWE(java.util.Map<T,IMWEDesc.IPart> partMap)
Constructs a new multi-word expression from a map of tokens to parts.
|
MWE(java.util.Map<T,IMWEDesc.IPart> partMap,
boolean reallocate)
Constructs a new multi-word expression from a map of tokens to parts.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(IMWE<?> one,
IMWE<?> two)
Returns true if the two MWEs use the same tokens and are assigned the
same root entries.
|
boolean |
equals(java.lang.Object obj) |
IMWEDesc |
getEntry()
Gets the MWE description object corresponding to this multi-word
expression.
|
java.lang.String |
getForm()
Returns the object's surface form text, exactly as it appears in its
original context, with capitalization intact.
|
java.util.Map<T,IMWEDesc.IPart> |
getPartMap()
Gets the mapping from tokens to parts in this multi-word expression.
|
java.util.List<T> |
getTokens()
Gets the list of tokens identified as comprising the multi-word
expression.
|
int |
hashCode() |
boolean |
isInflected()
Returns
true if this MWE is inflected relative to its
associated MWE description; false otherwise. |
static double |
overlap(IMWE<?> one,
IMWE<?> two)
Returns a score which is the ratio of the number of tokens shared between
the two MWEs and the total number of unique tokens in both MWEs together.
|
java.lang.String |
toString() |
public MWE(java.util.Map<T,IMWEDesc.IPart> partMap)
partMap - the map of tokens to MWE parts that will make up this
multi-word expression, may not be null or empty,
nor contain null. Iterating over the map should
return the tokens in the same order they are found in the
original sentence.java.lang.NullPointerException - if either argument is null, or the map contains
nulljava.lang.IllegalArgumentException - if the token map is emptypublic MWE(java.util.Map<T,IMWEDesc.IPart> partMap, boolean reallocate)
partMap - the map of tokens to MWE parts that will make up this
multi-word expression, may not be null or empty,
nor contain null. Iterating over the map should
return the tokens in the same order they are found in the
original sentence.reallocate - if true, reallocate the specified map; otherwise,
reuse the specified mapjava.lang.NullPointerException - if either argument is null, or the map contains
nulljava.lang.IllegalArgumentException - if the part map is empty, or the mwe description does not
match between the partspublic java.lang.String getForm()
IHasFormnull.public IMWEDesc getEntry()
IMWEnull.public java.util.List<T> getTokens()
IMWEnull or an empty list.public java.util.Map<T,IMWEDesc.IPart> getPartMap()
IMWEnull. Iteration order of the map should correspond to
the order of tokens in the original sentence.getPartMap in interface IMWE<T extends IToken>null map from tokens to parts in this MWE
objectpublic boolean isInflected()
IMWEtrue if this MWE is inflected relative to its
associated MWE description; false otherwise.isInflected in interface IMWE<T extends IToken>true if this MWE is inflected relative to its
associated MWE description; false otherwise.public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static boolean equals(IMWE<?> one, IMWE<?> two)
one - the first MWE to be compared; may be nulltwo - the second MWE to be compared; may be nullpublic static double overlap(IMWE<?> one, IMWE<?> two)
If the two MWEs being compared do not come from the same sentence, or share no tokens, the score will be zero.
one - the first MWE to be compared, may not be nulltwo - the second MWE to be compared, may not be nulljava.lang.NullPointerException - if either argument is nullCopyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.