|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.upenn.cis.propbank_shen.WordSpan
public class WordSpan
This class represents the span of a propbank argument or of the subtree
of a sentence
by a pair of integers indicating the first word of the
argument and the first word that is outside the argument.
It corresponds to the class TreeAddress
in the original
Propbank API and had to be changed to reflect Libin Shen's change
to the original propbank as described in his REAMDE file:
"Word IDs are used to represent the phrases, while in the original Propbank,
phrases are represented with the root node of the subtree in PTB."
The numbers start with zero, i.e. the initial word in a sentence is
the zeroth word.
Constructor Summary | |
---|---|
WordSpan(int s,
int e)
Construct a word span from a start and an end position |
Method Summary | |
---|---|
static WordSpan |
combine(WordSpan w1,
WordSpan w2)
Merge two WordSpan s. |
int |
compareTo(Object o)
Comparison of node addresses just uses comparison of start numbers backing off to end if start numbers are equal. |
int |
end()
|
boolean |
equals(Object o)
|
ElemTree |
getSubTree(Sentence s)
Attempts to find a subtree whose root ElemTree yields the words described by this span. |
int |
hashCode()
|
static WordSpan |
merge(Iterator wordSpans)
Merge any number of WordSpan s. |
static WordSpan |
ofString(String s)
Creates a WordSpan instance from a string of the form |
int |
start()
|
String |
toString()
Return a string of the form <start>_<end> |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WordSpan(int s, int e)
Method Detail |
---|
public static WordSpan combine(WordSpan w1, WordSpan w2)
WordSpan
s. Returns the smallest span that contains
each of the input spans. Always returns a continuous span.
If one of the arguments is null then the other one is returned.
If both of the arguments are null then an exception is raised.
public static WordSpan merge(Iterator wordSpans)
WordSpan
s. Returns the smallest span that contains
each of the input spans. Always returns a continuous span. Returns
an exception
if the iterator argument is empty.
wordSpans
- an Iterator
containing spans
WordSpan
that contains each of the input spanspublic ElemTree getSubTree(Sentence s)
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int compareTo(Object o)
compareTo
in interface Comparable
public String toString()
toString
in class Object
public static WordSpan ofString(String s) throws CorruptDataException
<terminal>_<end>
s
-
CorruptDataException
public int start()
public int end()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |