|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.upenn.cis.spinal.ElemTree
public class ElemTree
Represents a "spinal" elementary tree in Libin's LTAG
treebank. A typical elementary tree (taken from p. 73
of his thesis) looks like this:
#3 failed
spine: a_( S ( VP VBD^ ) )
att #0, on 0, slot 0, order 0
att #2, on 0, slot 0, order 1
att #6, on 0.0, slot 1, order 0
or like this (a structure for predicate coordination):
&20
spine: c_( S S S )
crd #3, on 0.0
att #9, on 0, slot 1, order 0
crd #10, on 0.1
Field Summary | |
---|---|
static int |
ADJOIN
Designates a tree combined with its parent by an adjunction operation, indicated by the keyword "adj". |
static int |
ATTACH
Designates a tree combined with its parent by an attachment operation, indicated by the keyword "att". |
static int |
AUXILIARY
Designates an auxiliary tree. |
static int |
CONJUNCT
Designates a tree combined with its parent by an attachment operation, indicated by the keyword "crd" in the output of the incremental parser and in the LTAG-spinal treebank. |
static int |
CONJUNCT_OR_CONNECTIVE
Designates a tree combined with its parent by a conjunction or an attachment operation, indicated by the keyword "con" in the output of the incremental parser and in the LTAG-spinal treebank. |
static int |
COORD
Designates a coordination tree -- these trees are special constructs and not anchored in a lexical item. |
static int |
INITIAL
Designates an initial tree. |
static int |
LEFT
Designates a tree that attaches/adjoins on the left of its parent. |
static int |
RIGHT
Designates a tree that attaches/adjoins on the right of its parent. |
static int |
ROOT
A return value designating a special case when the current tree that has no parent. |
static int |
UNKNOWN
Designates a field (tree, slot, etc.) of unknown type. |
Constructor Summary | |
---|---|
ElemTree(Sentence container,
String representation)
Creates an ElemTree from a string representation and attaches it
into the provided derivation tree (Sentence). |
Method Summary | |
---|---|
boolean |
attachesFromLeft()
Returns true if this ElemTree attaches or adjoins from the
left of its parent. |
boolean |
attachesFromRight()
Returns true if this ElemTree attaches or adjoins from the
right of its parent. |
boolean |
dominates(ElemTree other)
Returns true iff this ElemTree dominates the other tree
in the sentence (this includes
the case in which this.equals(other) ). |
SpinalNode |
getAnchor()
Returns the node representing the lexical anchor of this tree, or null if there is no anchor (in the case of a coordination structure). |
SpinalNode |
getAttachmentSite()
Returns the SpinalNode in the parent tree to which this ElemTree
is attached, or null if this ElemTree is the root of the derivation tree. |
int |
getAttachmentType()
Returns the type of the attachment of this elementary tree to its parent tree, one of ATTACH , ADJOIN , CONJUNCT (only used
in the LTAG-spinal treebank and in the output of the incremental parser),
and CONJUNCT_OR_CONNECTIVE (only used in the output of the
bidirectional parser). |
Iterator |
getChildren()
Returns the ElemTree s that attach to this ElemTree . |
Iterator |
getChildrenSpans()
Returns the spans of the ElemTree s that attach to this
ElemTree . |
List |
getDominatedElemTrees()
Returns a List of the elementary trees dominated by this
elementary tree,
including this tree itself. |
List |
getDominatedTerminals()
Returns a List of the terminals attached to the elementary trees
dominated by this elementary tree,
including this tree itself. |
int |
getFileNumber()
Returns the number of the file that contains the sentence to which this ElemTree belongs, or -1 if there is no such number. |
SpinalNode |
getFoot()
Returns the node representing the foot node (if any) of this tree, or null if there is no foot node. |
int |
getNumber()
Returns the number of this tree, corresponding to the position in the sentence. |
ElemTree |
getParent()
Returns the ElemTree to which this ElemTree attaches,
or null iff this is the root. |
PASLoc |
getPASLoc()
Returns the location of the predicate-argument structure corresponding to this elementary tree in the Propbank, or null if this tree has no section and file numbers. |
String |
getPOS()
Returns the part of speech of this elementary tree, or "NA" in the case of a coordination structure (where part of speech is not really applicable since Coord nodes aren't lexicalized). |
int |
getSectionNumber()
Returns the number of the section that contains the sentence to which this ElemTree belongs, or -1 if there is no such number. |
Sentence |
getSentence()
Return the Sentence to which this ElemTree
belongs. |
int |
getSentenceNumber()
Returns the number of the the sentence to which this ElemTree belongs, or -1 if there is no such number. |
int |
getSlot()
Returns whether this elementary tree attaches to the LEFT or RIGHT
side of its parent. |
WordSpan |
getSpan()
Returns the part of the sentence that is spanned by the yield of this elementary tree and its descendents. |
SpinalNode |
getSpinalNodeAt(GornAddress g)
Returns the spinal node at a given Gorn address in this tree. |
SpinalNode |
getSpine()
Returns the spine of this tree. |
String |
getSurfaceString()
Returns the yield of the subtree rooted in this elementary tree, with terminals separated by a single white space. |
String |
getTerminal()
Returns the actual terminal string (word in most cases) represented by this ElemTree . |
int |
getType()
Returns the type of this elementary tree, one of UNKNOWN , INITIAL , AUXILIARY , and COORD . |
String |
getTypeAsString()
Returns a string representing the type of this elementary tree, one of initial , auxiliary , coordination ,
and unknown . |
boolean |
hasChildren()
Returns true iff this ElemTree has other
ElemTree s attached to it. |
boolean |
isAuxiliary()
Returns true iff this tree is of type "auxiliary". |
boolean |
isBidirectionalParserOutput()
Returns true if this ElemTree has been read in from the
format used in the output of Shen's bidirectional parser. |
boolean |
isCoord()
Returns true iff this tree is of type "coordination". |
boolean |
isEmptyElement()
Returns if the anchor (if there is one) is an empty element by checking if the terminal has an unescaped asterisk. |
boolean |
isInitial()
Returns true iff this tree is of type "initial". |
boolean |
isOfUnknownType()
Returns true iff this tree is of unknown type. |
boolean |
isParentOf(ElemTree other)
Returns true iff this ElemTree is the direct parent of
the other tree in the derivation tree. |
boolean |
isRoot()
Returns true iff this elementary tree has no parent. |
String |
toString()
Converts this tree to a canonical string representation of the kind used in Libin Shen's thesis. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int INITIAL
public static final int AUXILIARY
public static final int COORD
public static final int ROOT
public static final int ATTACH
public static final int ADJOIN
public static final int CONJUNCT
public static final int CONJUNCT_OR_CONNECTIVE
public static final int LEFT
public static final int RIGHT
Constructor Detail |
---|
public ElemTree(Sentence container, String representation) throws ElemTreeFormatException
ElemTree
from a string representation and attaches it
into the provided derivation tree (Sentence). We assume that the nodes are
numbered in ascending order of linear precedence of their anchors, as
is the case in the LTAG-spinal treebank.
container
- the Sentence
to which this
ElemTree
is to be addedrepresentation
- the string that is to be parsed into an
ElemTree
ElemTreeFormatException
- if the
string representation is not well-formedMethod Detail |
---|
public boolean attachesFromLeft()
ElemTree
attaches or adjoins from the
left of its parent.
getSlot()
public boolean attachesFromRight()
ElemTree
attaches or adjoins from the
right of its parent.
getSlot()
public SpinalNode getAnchor()
SpinalNode
element representing the lexical anchorpublic SpinalNode getAttachmentSite()
SpinalNode
in the parent tree to which this ElemTree
is attached, or null if this ElemTree
is the root of the derivation tree.
public int getAttachmentType()
ATTACH
, ADJOIN
, CONJUNCT
(only used
in the LTAG-spinal treebank and in the output of the incremental parser),
and CONJUNCT_OR_CONNECTIVE
(only used in the output of the
bidirectional parser). If this elementary tree is the root of the sentence,
the special value ROOT
is returned.
ElemTree
public Iterator getChildren()
ElemTree
s that attach to this ElemTree
.
public Iterator getChildrenSpans()
ElemTree
s that attach to this
ElemTree
.
public List getDominatedElemTrees()
List
of the elementary trees dominated by this
elementary tree,
including this tree itself.
ElemTree
objectspublic List getDominatedTerminals()
List
of the terminals attached to the elementary trees
dominated by this elementary tree,
including this tree itself.
String
objects)public int getFileNumber()
ElemTree
belongs, or -1 if there is no such number.
int
public SpinalNode getFoot()
SpinalNode
public int getNumber()
public PASLoc getPASLoc()
wsj/<section>/wsj_<section><file>.mrg
.
public String getPOS()
public ElemTree getParent()
ElemTree
to which this ElemTree
attaches,
or null iff this is the root.
public int getSectionNumber()
ElemTree
belongs, or -1 if there is no such number.
int
public Sentence getSentence()
Sentence
to which this ElemTree
belongs.
Sentence
objectpublic int getSentenceNumber()
ElemTree
belongs, or -1 if there is no such number.
int
public int getSlot()
LEFT
or RIGHT
side of its parent. Returns ROOT
if this tree is the root of the
sentence and UNKNOWN
if the value is not known.
attachesFromLeft()
,
attachesFromRight()
public WordSpan getSpan()
ElemTree
locations are given.
WordSpan
objectpublic SpinalNode getSpinalNodeAt(GornAddress g)
g
- a GornAddress
SpinalNode
public SpinalNode getSpine()
SpinalNode
representing the root of the spinepublic String getSurfaceString()
ElemTree
and all its descendents.public String getTerminal()
ElemTree
.
public int getType()
UNKNOWN
, INITIAL
, AUXILIARY
, and COORD
.
ElemTree
public String getTypeAsString()
initial
, auxiliary
, coordination
,
and unknown
.
ElemTree
in string representationpublic boolean isCoord()
public boolean isAuxiliary()
public boolean isInitial()
public boolean isOfUnknownType()
public boolean isEmptyElement()
public boolean isRoot()
public boolean hasChildren()
ElemTree
has other
ElemTree
s attached to it.
public String toString()
toString
in class Object
public boolean dominates(ElemTree other)
ElemTree
dominates the other tree
in the sentence (this includes
the case in which this.equals(other)
).
other
- the other tree
public boolean isParentOf(ElemTree other)
ElemTree
is the direct parent of
the other tree in the derivation tree.
other
- the other tree
public boolean isBidirectionalParserOutput()
ElemTree
has been read in from the
format used in the output of Shen's bidirectional parser. If this is the case,
no information about the spine is present.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |