Home | Trees | Indices | Help |
|
---|
|
object --+ | list --+ | Tree
A hierarchical structure.
Each Tree
represents a single hierarchical grouping of
leaves and subtrees. For example, each constituent in a syntax tree is
represented by a single Tree
.
A tree's children are encoded as a list
of leaves and
subtrees, where a leaf
is a basic (non-tree) value; and a subtree is a nested Tree
.
Any other properties that a Tree
defines are known as node
properties, and are used to add information about individual
hierarchical groupings. For example, syntax trees use a NODE property to
label syntactic constituents with phrase tags, such as "NP"
and"VP".
Several Tree
methods use tree positions
to specify children or descendants of a tree. Tree positions are defined
as follows:
Tree
's ith child.
()
specifies the Tree
itself.
p
is the tree position of
descendant d, then p+(i)
specifies the
i
th child of d.
I.e., every tree position is either a single index i
, specifying self[i]
; or a sequence (i1,
i2, ..., iN)
, specifying
self[i1][i2]...[iN]
.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Tree
|
|
||
|
|||
int
|
|
||
list
|
|
||
string
|
|
||
string
|
|
||
|
|||
list of Production s
|
|
||
|
|||
|
|||
Inherited from Inherited from |
|
|||
|
|
|||
|
x+y
|
del x[y]
|
x==y
|
x>=y
|
x[y]
|
x>y
|
Construct a new tree.
|
x<=y
|
x<y
|
x*n
|
x!=y
|
repr(x)
|
n*x
|
x[i]=y
|
str(x)
|
Convert a tree between different subtypes of Tree.
|
|
|
|
|
Returns a representation of the tree compatible with the LaTeX qtree
package. This consists of the string For example, the following result was generated from a parse tree of
the sentence \Tree [.I'' [.N'' [.D The ] [.N' [.N announcement ] ] ] [.I' [.V'' [.V' [.V astounded ] [.N'' [.N' [.N us ] ] ] ] ] ] ] See http://www.ling.upenn.edu/advice/latex.html for the LaTeX style file for the qtree package.
|
Generate the productions that correspond to the non-terminal nodes of the tree. For each subtree of the form (P: C1 C2 ... Cn) this produces a production of the form P -> C1 C2 ... Cn.
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Wed May 16 22:47:30 2007 | http://epydoc.sourceforge.net |