org.jscience.ml.tigerxml
Class NT

java.lang.Object
  extended by org.jscience.ml.tigerxml.GraphNode
      extended by org.jscience.ml.tigerxml.NT
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
VRoot

public class NT
extends GraphNode

Represents a non-terminal node a syntax tree.

See Also:
GraphNode, Serialized Form

Field Summary
 
Fields inherited from class org.jscience.ml.tigerxml.GraphNode
verbosity
 
Constructor Summary
NT()
          Creates an empty NT setting all member variables to null or empty.
NT(org.w3c.dom.Element ntElement, Sentence sent)
           
NT(org.w3c.dom.Element ntElement, Sentence sent, int verbosity)
           
 
Method Summary
 void addDaughter(GraphNode newDaughter)
          Adds a daughter.
 void addSecDaughter(GraphNode newDaughter)
          Adds a secondary daughter.
 java.util.ArrayList getAllDaughters()
          Returns an ArrayList of all daughters, primary as well as secondary, ordered left to right according to linear precedence.
 java.util.ArrayList getAllDaughtersByLabel(java.lang.String edgelabel)
          Returns an ArrayList of all the daughter nodes, primary as well as secondary ones, with a given edge label.
 java.util.ArrayList getAllDescendants()
          Returns an ArrayList of all descendant nodes, primary as well as secondary ones, of this node.
 java.util.ArrayList getAllDescendantsByLabel(java.lang.String edgelabel)
          Returns an ArrayList of all descendant nodes, primary as well as secondary ones, with a given edge label.
 java.lang.String getCat()
          Returns the category of this NT
 java.util.ArrayList getDaughters()
          Returns an ArrayList of the daughter nodes ordered left to right according to linear precedence.
 java.util.ArrayList getDaughtersByLabel(java.lang.String edgelabel)
          Returns an ArrayList of the daughter nodes with a given edge label.
 java.util.ArrayList getDescendants()
          Returns an ArrayList of the descendant nodes of this node.
 java.util.ArrayList getDescendantsByLabel(java.lang.String edgelabel)
          Returns an ArrayList of the descendant nodes with a given edge label.
 java.util.ArrayList getSecDaughters()
          Returns an ArrayList of the secondary daughter nodes ordered left to right according to linear precedence.
 java.lang.String getSpan()
          Returns the span (the list of terminal node IDs).
 java.util.ArrayList getTerminals()
          Returns all terminal daughters recursively.
 java.lang.String getText()
          Returns the surface of this NT - the String consisting of all terminals underneath this node.
 java.lang.String getWords()
          Returns the surface of this NT - the String consisting of all terminals underneath this node.
 boolean hasSecDaughters()
          Returns true if this node has secondary daughters.
protected  void print2Xml(java.io.FileWriter out_xml)
           
 void setCat(java.lang.String newcat)
          Sets the category of this NT
 
Methods inherited from class org.jscience.ml.tigerxml.GraphNode
before, dominates, equals, getCorpus, getDominatingNodeByCat, getEdge2Mother, getEdge2SecMother, getId, getIndex, getLeftmostTerminal, getMother, getPath, getSecMothers, getSentence, getVerbosity, hasMother, hasSecMothers, hasSurfaceWord, isDominatedBy, isDominatedBy, isTerminal, printNode, printNode, printNodeErr, printNodeErr, printTree, printTreeErr, setEdge2Mother, setId, setIndex, setMother, setSecMother, setSentence, setTerminal, setVerbosity, toNodeInfoString, toString, toTreeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NT

public NT()
Creates an empty NT setting all member variables to null or empty.


NT

public NT(org.w3c.dom.Element ntElement,
          Sentence sent)

NT

public NT(org.w3c.dom.Element ntElement,
          Sentence sent,
          int verbosity)
Method Detail

addDaughter

public void addDaughter(GraphNode newDaughter)
Adds a daughter. Can by a NT, a T, or a GraphNode.


addSecDaughter

public void addSecDaughter(GraphNode newDaughter)
Adds a secondary daughter. Can be a NT, a T, or a GraphNode.


hasSecDaughters

public boolean hasSecDaughters()
Returns true if this node has secondary daughters.


setCat

public void setCat(java.lang.String newcat)
Sets the category of this NT


getCat

public java.lang.String getCat()
Returns the category of this NT


getSpan

public java.lang.String getSpan()
Returns the span (the list of terminal node IDs).

The concept "span" is taken from MMAX (http://www.eml.org/nlp). The idea is to have a compact string representation of all terminal IDs underneath this NT.

For more methods related to MMAX concepts

See Also:
SyncMMAX

getDaughters

public java.util.ArrayList getDaughters()
Returns an ArrayList of the daughter nodes ordered left to right according to linear precedence. Note that if you want to get information like POS, MORPH, or CAT you have to look up the type of each child like this: GraphNode n = someNode.getChildren().get(1); if (n.isTerminal) { fooPos = n.getPos(); }


getSecDaughters

public java.util.ArrayList getSecDaughters()
Returns an ArrayList of the secondary daughter nodes ordered left to right according to linear precedence. Note that if you want to get information like POS, MORPH, or CAT you have to look up the type of each child like this: GraphNode n = (GraphNode) someNode.getSDaughters().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getAllDaughters

public java.util.ArrayList getAllDaughters()
Returns an ArrayList of all daughters, primary as well as secondary, ordered left to right according to linear precedence. Note that if you want to get information like POS, MORPH, or CAT you have to look up the type of each child like this: GraphNode n = (GraphNode) someNode.getAllDaughters().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getTerminals

public java.util.ArrayList getTerminals()
Returns all terminal daughters recursively. The returned terminals are in the order of the sentence (linear precedence).


getWords

public java.lang.String getWords()
Returns the surface of this NT - the String consisting of all terminals underneath this node.

Returns:
The String representation (all terminal nodes' word strings).

getText

public java.lang.String getText()
Returns the surface of this NT - the String consisting of all terminals underneath this node.

Overrides:
getText in class GraphNode
Returns:
The String representation (all terminal nodes' word strings).

getDescendants

public java.util.ArrayList getDescendants()
Returns an ArrayList of the descendant nodes of this node. The descendants are ordered breadth first then left to right. Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getDescendants().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getAllDescendants

public java.util.ArrayList getAllDescendants()
Returns an ArrayList of all descendant nodes, primary as well as secondary ones, of this node. The descendants are ordered breadth first then left to right. Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getAllDescendants().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getDaughtersByLabel

public java.util.ArrayList getDaughtersByLabel(java.lang.String edgelabel)
Returns an ArrayList of the daughter nodes with a given edge label. The list is ordered left to right according to word order Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getDaughtersByLabel().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getAllDaughtersByLabel

public java.util.ArrayList getAllDaughtersByLabel(java.lang.String edgelabel)
Returns an ArrayList of all the daughter nodes, primary as well as secondary ones, with a given edge label. The list is ordered left to right according to word order Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getAllDaughtersByLabel().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getDescendantsByLabel

public java.util.ArrayList getDescendantsByLabel(java.lang.String edgelabel)
Returns an ArrayList of the descendant nodes with a given edge label. The descendants are ordered breadth first then left to right. Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getDescendantsByLabel().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


getAllDescendantsByLabel

public java.util.ArrayList getAllDescendantsByLabel(java.lang.String edgelabel)
Returns an ArrayList of all descendant nodes, primary as well as secondary ones, with a given edge label. The descendants are ordered breadth first then left to right. Note that you have to look up the type of each child like this, if you want to get information like POS, MORPH, or CAT: GraphNode n = (GraphNode) someNode.getAllDescendantsByLabel().get(1);

if (n.isTerminal()) { String fooPos = ((T)n).getPos(); }


print2Xml

protected void print2Xml(java.io.FileWriter out_xml)