|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.upenn.cis.spinal.SpinalNode
public class SpinalNode
Represents the spine of a spinal elementary tree. A typical line in the treebank that contains a spine looks like this:
b_( VP VB^ VP* )However, the first letter indicates a property of the elementary tree (whether it is initial, auxiliary, or coordination) and is strictly speaking not a part of the spine, nor is the underscore folloing it. So we only consider the following a spine:
( VP VB^ VP* )Other examples of spines:
( S ( VP VBD^ ) ) ( S ( VP ( XP JJ^ ) ) ) ( XP NONE^ ) JJ^ ( S S S ) # a spine for predicate coordinationSpines may be of three shapes (Libin Shen's thesis, p. 15):
Field Summary | |
---|---|
static String |
ANCHOR
Represents the character used to show that a node is an anchor node (the node where the word is attached), i.e. |
static String |
ANCHORS
Some alternative characters that might be used for the anchor because they look similar. |
static String |
FOOT
Represents the character used to show that a node is a foot node, in an auxiliary tree, i.e. |
static String |
STANDARD
Represents the character used to show that a node is neither an anchor nor a foot node (this character is the empty string in Libin Shen's treebank). |
Constructor Summary | |
---|---|
protected |
SpinalNode(List list,
ElemTree host)
Creates an instance of SpinalNode from a tokenized list of strings. |
|
SpinalNode(String s,
ElemTree host)
Creates a new instance of SpinalNode from a string representation. |
Method Summary | |
---|---|
List |
getAllNodes()
Returns a list of all the descendents of this spinal node, including itself. |
SpinalNode |
getChild(int n)
Returns the specified child of this spinal node. |
SpinalNode[] |
getChildren()
Returns an array of children, or null if there are no children to this node. |
List |
getChildrenList()
Returns a list of children, or an empty list if there are no children to this node. |
ElemTree |
getElemTree()
Gets the elementary tree to which this spine or spinal node belongs. |
String |
getLabel()
Gets the label of this spinal node. |
GornAddress |
getLocationInSpine()
Returns the GornAddress of this spinal node, relative to the
root of the spine in which it is contained (rather than the root of the
derivation tree in which it is contained). |
SpinalNode |
getParent(boolean acrossElemTrees)
Returns the SpinalNode that is the parent of this node. |
String |
getType()
Gets the type of this SpinalNode . |
boolean |
isAnchor()
Returns whether this node is an anchor node. |
boolean |
isFoot()
Returns whether this node is a foot node. |
boolean |
isRootOfSpine()
Returns whether this node is at the root of its spine. |
boolean |
isStandard()
Returns whether this node is a standard node (neither foot nor anchor). |
String |
toString()
Returns a canonical representation of the subtree rooted in this spinal node (e.g. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ANCHOR
^
".
public static final String ANCHORS
ˆ \\u02C6
-- unicode modifier letter circumflex accent
^ \\u005E
-- unicode circumflex accent
̂ \\u0302
-- unicode combining circumflex accent
public static final String FOOT
*
".
public static final String STANDARD
Constructor Detail |
---|
public SpinalNode(String s, ElemTree host) throws ElemTreeFormatException
SpinalNode
from a string representation.
s
- the string representation from which to create the SpinalNode
host
- the ElemTree
to which the spine belongs of which this
SpinalNode
is a member, or null if you don't wish to specify it
ElemTreeFormatException
- if the input string can't be parsedprotected SpinalNode(List list, ElemTree host) throws ElemTreeFormatException
SpinalNode
from a tokenized list of strings.
The list is not modified during the construction of the SpinalNode
.
list
- the list of stringshost
- the ElemTree
to which the spine belongs of which this
SpinalNode
is a member, or null if you don't wish to specify it
ElemTreeFormatException
- if list is empty
NullPointerException
- if list is nullMethod Detail |
---|
public String getLabel()
XP
or NNS
.
Characters that denote foot nodes or
anchors are not returned.public String getType()
SpinalNode
. Returns one of "ANCHOR", "FOOT", or
"STANDARD".
public boolean isAnchor()
public boolean isFoot()
public boolean isStandard()
public SpinalNode[] getChildren()
public List getChildrenList()
public List getAllNodes()
public SpinalNode getChild(int n)
n
- a number specifying the child, starting with zero.
SpinalNode
for the child
ArrayIndexOutOfBoundsException
- if this node does not have as many
children as the specified indexpublic GornAddress getLocationInSpine()
GornAddress
of this spinal node, relative to the
root of the spine in which it is contained (rather than the root of the
derivation tree in which it is contained).
0
for the root of the spinepublic String toString()
(XP NNS^)
).
toString
in class Object
public ElemTree getElemTree()
public SpinalNode getParent(boolean acrossElemTrees)
SpinalNode
that is the parent of this node.
acrossElemTrees
- if true, then if this node is at the root of
its ElemTree
, then the attachment site in the parent ElemTree
will be
returned; otherwise if this node is at the root of its ElemTree
, null will
be returned
public boolean isRootOfSpine()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |