|
Pep 0.4 API Documentation | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.osu.ling.pep.ParseTree
public class ParseTree
A parse tree that represents the derivation of a string based on the
rules in a Grammar
. Parse trees recursively contain
other parse trees
, so they can be iterated through to
find the entire derivation of a category. A parse tree can also be
traversed upward by calling getParent()
for each successive parse
tree until it returns null
.
Parse trees are essentially partial views of a Chart
from a
given Edge
or Category
. They represent the completed
categories at a given string index and origin position. The special
Category.START
category is not included in a parse tree at the root
(only categories that are actually specified in the corresponding grammar
are represented).
Parse.getParseTreesFor(Category, int, int)
Constructor Summary | |
---|---|
ParseTree(Category node,
ParseTree parent)
Creates a new parse tree with the specified category and parent parse tree. |
|
ParseTree(Category node,
ParseTree parent,
ParseTree[] children)
Creates a new parse tree with the specified category, parent, and child trees. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Tests whether this parse tree is equal to another by comparing its node, parent, and child parse trees. |
ParseTree[] |
getChildren()
Gets the child parse trees of this parse tree, retaining their linear ordering. |
Category |
getNode()
Gets the node category of this parse tree. |
ParseTree |
getParent()
Gets the parent parse tree, if any. |
int |
hashCode()
Computes a hash code for this parse tree based on its underlying edge and child parse trees. |
static ParseTree |
newParseTree(Edge edge)
Creates a parse tree based on the specified edge that is the root of the resulting parse tree. |
static ParseTree |
newParseTree(Edge edge,
ParseTree parent)
Creates a new parse tree based on the specified edge and parent tree. |
String |
toString()
Gets a string representation of this parse tree. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ParseTree(Category node, ParseTree parent)
ParseTree(Category, ParseTree, ParseTree[])
public ParseTree(Category node, ParseTree parent, ParseTree[] children)
node
- The category of the node
of this parse
tree.parent
- This parse tree's parent tree, or null
if
this parse tree is the root node.children
- The list of children of this parse tree, in their linear
order.Method Detail |
---|
public boolean equals(Object obj)
equals
in class Object
public ParseTree[] getChildren()
NP -> Det N
, returns an array
that contains parse trees whose node
is
Det, N
in that order, or null
if this parse
tree has no children.public Category getNode()
NP
for a subtree NP -> Det N
.public ParseTree getParent()
S -> NP VP
if this parse tree's node
is NP
and is
one of the children of S
. If this parse tree is the root
node in a series of parse trees, returns null
.public int hashCode()
hashCode
in class Object
public static ParseTree newParseTree(Edge edge)
edge
- The edge that is to be at the root of the parse tree.
newParseTree(Edge, ParseTree)
with
null
as the argument for the parent parse tree.newParseTree(Edge, ParseTree)
public static ParseTree newParseTree(Edge edge, ParseTree parent)
edge
- The edge to use to create a parse tree. For a parse tree
that is the root, this should be null
.parent
- The parent tree of the new parse tree.
node
is the
specified edge's dotted rule's left side and whose children are based
on the bases
of the specified edge.public String toString()
toString
in class Object
[S[NP[Det[the]][N[boy]]][VP[left]]]
(The actual string would depend on the grammar rules in effect for the
parse).
|
Pep: Pep is an Earley parser | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the overview file.