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
null
java.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
null
java.lang.IllegalArgumentException
- if the part map is empty, or the mwe description does not
match between the partspublic java.lang.String getForm()
IHasForm
null
.public IMWEDesc getEntry()
IMWE
null
.public java.util.List<T> getTokens()
IMWE
null
or an empty list.public java.util.Map<T,IMWEDesc.IPart> getPartMap()
IMWE
null
. 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()
IMWE
true
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.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static boolean equals(IMWE<?> one, IMWE<?> two)
one
- the first MWE to be compared; may be null
two
- the second MWE to be compared; may be null
public 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 null
two
- the second MWE to be compared, may not be null
java.lang.NullPointerException
- if either argument is null
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.