|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.data.MWE<T>
T
- type of IToken
objects that form the multi-word expressionpublic class MWE<T extends IToken>
Default implementation of the IMWE
interface.
Constructor Summary | |
---|---|
MWE(Map<T,IMWEDesc.IPart> partMap)
Constructs a new multi-word expression from a map of tokens to parts. |
|
MWE(Map<T,IMWEDesc.IPart> partMap,
boolean reallocate)
Constructs a new multi-word expression from a map of tokens to parts. |
Method Summary | |
---|---|
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(Object obj)
|
IMWEDesc |
getEntry()
Gets the MWE description object corresponding to this multi-word expression. |
String |
getForm()
Returns the object's surface form text, exactly as it appears in its original context, with capitalization intact. |
Map<T,IMWEDesc.IPart> |
getPartMap()
Gets the mapping from tokens to parts in this multi-word expression. |
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. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MWE(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.
NullPointerException
- if either argument is null
, or the map contains
null
IllegalArgumentException
- if the token map is emptypublic MWE(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 map
NullPointerException
- if either argument is null
, or the map contains
null
IllegalArgumentException
- if the part map is empty, or the mwe description does not
match between the partsMethod Detail |
---|
public String getForm()
IHasForm
null
.
getForm
in interface IHasForm
null
.public IMWEDesc getEntry()
IMWE
null
.
getEntry
in interface IMWE<T extends IToken>
null
MWE description corresponding to the
multi-word expression represented by this object.public List<T> getTokens()
IMWE
null
or an empty list.
getTokens
in interface IMWE<T extends IToken>
null
, non-empty list of tokens that comprise
the multi-word expression.public 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 String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class 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.
NullPointerException
- if either argument is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |