Jet.Parser
Class ParseTreeNode

java.lang.Object
  extended byJet.Parser.Edge
      extended byJet.Parser.ParseTreeNode

public class ParseTreeNode
extends Edge

a node of a parse tree.


Field Summary
 Annotation ann
          for leaf nodes, the (token or constit) annotation matched by this node.
 int head
          for non-leaf nodes, the number of the child (starting at 1) which is the head of this node.
 java.lang.String word
          for leaf nodes, the word matched by this node.
 
Fields inherited from class Jet.Parser.Edge
category, children, end, start
 
Constructor Summary
ParseTreeNode(java.lang.Object category, ParseTreeNode[] children, int start, int end, Annotation ann, java.lang.String word)
           
ParseTreeNode(java.lang.Object category, ParseTreeNode[] children, int start, int end, int head)
           
 
Method Summary
static Annotation[] children(Annotation node)
          returns an array containing the children of 'node', or null if the node has no children.
static Annotation makeParseAnnotations(Document doc, ParseTreeNode n)
          given a parse tree in the form of nested ParseTreeNodes, adds an Annotation of type 'constit' to Document 'doc' for each non-terminal node in the tree.
 void printTree()
          prints the parse tree rooted at this node in an indented form.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ann

public Annotation ann
for leaf nodes, the (token or constit) annotation matched by this node. For non-leaf nodes, = null in parser output. StatParser.makeParseAnnotations sets this field to the annotation generated from this node.


word

public java.lang.String word
for leaf nodes, the word matched by this node. (For non-leaf nodes, = null.)


head

public int head
for non-leaf nodes, the number of the child (starting at 1) which is the head of this node. = 0 if not set.

Constructor Detail

ParseTreeNode

public ParseTreeNode(java.lang.Object category,
                     ParseTreeNode[] children,
                     int start,
                     int end,
                     Annotation ann,
                     java.lang.String word)

ParseTreeNode

public ParseTreeNode(java.lang.Object category,
                     ParseTreeNode[] children,
                     int start,
                     int end,
                     int head)
Method Detail

toString

public java.lang.String toString()

printTree

public void printTree()
prints the parse tree rooted at this node in an indented form.


makeParseAnnotations

public static Annotation makeParseAnnotations(Document doc,
                                              ParseTreeNode n)
given a parse tree in the form of nested ParseTreeNodes, adds an Annotation of type 'constit' to Document 'doc' for each non-terminal node in the tree. (Annotations are already present for terminal nodes, as a prerequisite for parsing.) Returns the Annotation associated with the root node of the tree.


children

public static Annotation[] children(Annotation node)
returns an array containing the children of 'node', or null if the node has no children.

Parameters:
node - an Annotation representing a parse tree node (an Annotation of type 'constit').