MaltParser 1.4.1

org.maltparser.core.syntaxgraph.node
Class Token

java.lang.Object
  extended by java.util.Observable
      extended by org.maltparser.core.syntaxgraph.GraphElement
          extended by org.maltparser.core.syntaxgraph.node.GraphNode
              extended by org.maltparser.core.syntaxgraph.node.Token
All Implemented Interfaces:
Comparable<ComparableNode>, Element, ComparableNode, DependencyNode, Node, PhraseStructureNode, TokenNode

public class Token
extends GraphNode
implements TokenNode, DependencyNode, PhraseStructureNode


Field Summary
protected  DependencyNode component
          a reference to a node where the node is part of a component.
protected  SortedSet<DependencyNode> heads
           
protected  int index
           
protected  SortedSet<DependencyNode> leftDependents
           
protected  PhraseStructureNode parent
           
protected  TokenNode predecessor
          the previous terminal node in the linear precedence
protected  int rank
           
protected  SortedSet<DependencyNode> rightDependents
           
protected  TokenNode successor
          the next terminal node in the linear precedence
 
Fields inherited from class org.maltparser.core.syntaxgraph.node.GraphNode
incomingEdges, outgoingEdges
 
Constructor Summary
Token()
           
 
Method Summary
 void addHeadEdgeLabel(LabelSet labelSet)
           
 void addHeadEdgeLabel(SymbolTable table, int code)
           
 void addHeadEdgeLabel(SymbolTable table, String symbol)
           
 void addIncomingEdge(Edge in)
           
 void addOutgoingEdge(Edge out)
           
 void clear()
          Resets the graph element.
 int compareTo(ComparableNode that)
           
 boolean equals(Object obj)
           
 DependencyNode findComponent()
           
 DependencyNode getAncestor()
           
 DependencyNode getClosestLeftDependent()
          Returns the closest left dependent to the node it self, if not found null is returned.
 DependencyNode getClosestRightDependent()
          Returns the closest right dependent to the node it self, if not found null is returned.
 int getCompareToIndex()
          Returns the index of the node (only used internal by compareTo).
 DependencyNode getComponent()
           
protected  void getDependencyDominationSet(SortedSet<DependencyNode> dominationSet)
           
 int getDependencyNodeDepth()
          Returns the depth of the node.
 DependencyNode getHead()
          Returns the head dependency node if it exists, otherwise null.
 Edge getHeadEdge()
          Returns the edge between the head and the node if it exists, otherwise null.
 int getHeadEdgeLabelCode(SymbolTable table)
           
 LabelSet getHeadEdgeLabelSet()
           
 String getHeadEdgeLabelSymbol(SymbolTable table)
           
 Set<SymbolTable> getHeadEdgeLabelTypes()
           
 Set<Edge> getHeadEdges()
           
 Set<DependencyNode> getHeads()
           
 int getIndex()
          Returns the index of the node.
 DependencyNode getLeftDependent(int index)
          Returns the left dependent at the position index, where index==0 equals the left most dependent.
 int getLeftDependentCount()
          Return the number of left dependents
 SortedSet<DependencyNode> getLeftDependents()
          Returns a sorted set of left dependents.
 DependencyNode getLeftmostDependent()
           
 ComparableNode getLeftmostDescendant()
          Returns the left-most terminal descendant node.
 ComparableNode getLeftmostProperDescendant()
          Returns the left-most proper terminal descendant node (excluding itself).
 DependencyNode getLeftSibling()
          Returns the left sibling if it exists, otherwise null
 PhraseStructureNode getParent()
           
 Edge getParentEdge()
           
 int getParentEdgeLabelCode(SymbolTable table)
           
 String getParentEdgeLabelSymbol(SymbolTable table)
           
 TokenNode getPredecessor()
          Returns the predecessor terminal node in the linear order of the terminal nodes.
 DependencyNode getProperAncestor()
           
 int getRank()
           
 DependencyNode getRightDependent(int index)
           
 int getRightDependentCount()
          Return the number of right dependents
 SortedSet<DependencyNode> getRightDependents()
          Returns a sorted set of right dependents.
 DependencyNode getRightmostDependent()
           
 ComparableNode getRightmostDescendant()
          Returns the right-most terminal descendant node.
 ComparableNode getRightmostProperDescendant()
          Returns the right-most proper terminal descendant node (excluding itself).
 DependencyNode getRightSibling()
          Returns the right sibling if it exists, otherwise null
 DependencyNode getSameSideLeftSibling()
          Returns the left sibling at the same side of head as the node it self.
 DependencyNode getSameSideRightSibling()
          Returns the right sibling at the same side of head as the node it self.
 TokenNode getSuccessor()
          Returns the successor terminal node in the linear order of the terminal nodes.
 boolean hasAncestorInside(int left, int right)
           
 boolean hasAtMostOneHead()
          Returns true if the node has at most one head, otherwise false.
 boolean hasDependent()
           
 int hashCode()
           
 boolean hasHead()
          Returns true if the node has one or more head(s), otherwise false.
 boolean hasHeadEdgeLabel(SymbolTable table)
           
 boolean hasLeftDependent()
          Returns true if the node has one or more left dependents, otherwise false.
 boolean hasParentEdgeLabel(SymbolTable table)
           
 boolean hasRightDependent()
          Returns true if the node has one or more right dependents, otherwise false.
 boolean isHeadEdgeLabeled()
           
 boolean isProjective()
          Returns true if the head edge is projective, otherwise false.
 boolean isRoot()
          Returns true if the node is a root node, otherwise false.
 int nHeadEdgeLabels()
           
 void removeIncomingEdge(Edge in)
           
 void removeOutgoingEdge(Edge out)
           
 void setComponent(DependencyNode x)
           
 void setIndex(int index)
           
 void setPredecessor(TokenNode predecessor)
          Sets the predecessor terminal node in the linear order of the terminal nodes.
 void setRank(int r)
           
 void setSuccessor(TokenNode successor)
          Sets the predecessor terminal node in the linear order of the terminal nodes.
 String toString()
           
 
Methods inherited from class org.maltparser.core.syntaxgraph.node.GraphNode
getIncomingEdgeIterator, getIncomingSecondaryEdges, getInDegree, getLeftmostDescendantIndex, getLeftmostProperDescendantIndex, getOutDegree, getOutgoingEdgeIterator, getOutgoingSecondaryEdges, getRightmostDescendantIndex, getRightmostProperDescendantIndex
 
Methods inherited from class org.maltparser.core.syntaxgraph.GraphElement
addLabel, addLabel, addLabel, compareTo, getBelongsToGraph, getLabelCode, getLabelSet, getLabelSymbol, getLabelTypes, hasLabel, isLabeled, nLabels, removeLabel, removeLabels, setBelongsToGraph
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.maltparser.core.syntaxgraph.node.ComparableNode
getIncomingSecondaryEdges, getInDegree, getLeftmostDescendantIndex, getLeftmostProperDescendantIndex, getOutDegree, getOutgoingSecondaryEdges, getRightmostDescendantIndex, getRightmostProperDescendantIndex
 
Methods inherited from interface org.maltparser.core.syntaxgraph.Element
addLabel, addLabel, addLabel, getBelongsToGraph, getLabelCode, getLabelSet, getLabelSymbol, getLabelTypes, hasLabel, isLabeled, nLabels, removeLabel, removeLabels, setBelongsToGraph
 

Field Detail

predecessor

protected TokenNode predecessor
the previous terminal node in the linear precedence


successor

protected TokenNode successor
the next terminal node in the linear precedence


component

protected DependencyNode component
a reference to a node where the node is part of a component. If the node is unconnected it will reference to it self.


rank

protected int rank

index

protected int index

parent

protected PhraseStructureNode parent

heads

protected final SortedSet<DependencyNode> heads

leftDependents

protected final SortedSet<DependencyNode> leftDependents

rightDependents

protected final SortedSet<DependencyNode> rightDependents
Constructor Detail

Token

public Token()
      throws MaltChainedException
Throws:
MaltChainedException
Method Detail

setPredecessor

public void setPredecessor(TokenNode predecessor)
Sets the predecessor terminal node in the linear order of the terminal nodes.

Specified by:
setPredecessor in interface TokenNode
Parameters:
predecessor - the predecessor terminal node

setSuccessor

public void setSuccessor(TokenNode successor)
Sets the predecessor terminal node in the linear order of the terminal nodes.

Specified by:
setSuccessor in interface TokenNode
Parameters:
successor - the successor terminal node

getPredecessor

public TokenNode getPredecessor()
Returns the predecessor terminal node in the linear order of the terminal nodes.

Specified by:
getPredecessor in interface TokenNode
Returns:
the predecessor terminal node in the linear order of the terminal nodes.

getSuccessor

public TokenNode getSuccessor()
Returns the successor terminal node in the linear order of the terminal nodes.

Specified by:
getSuccessor in interface TokenNode
Returns:
the successor terminal node in the linear order of the terminal nodes.

getRank

public int getRank()
Specified by:
getRank in interface DependencyNode

setRank

public void setRank(int r)
Specified by:
setRank in interface DependencyNode

findComponent

public DependencyNode findComponent()
Specified by:
findComponent in interface DependencyNode

getComponent

public DependencyNode getComponent()
Specified by:
getComponent in interface DependencyNode

setComponent

public void setComponent(DependencyNode x)
Specified by:
setComponent in interface DependencyNode

addIncomingEdge

public void addIncomingEdge(Edge in)
                     throws MaltChainedException
Specified by:
addIncomingEdge in interface Node
Overrides:
addIncomingEdge in class GraphNode
Throws:
MaltChainedException

removeIncomingEdge

public void removeIncomingEdge(Edge in)
                        throws MaltChainedException
Specified by:
removeIncomingEdge in interface Node
Overrides:
removeIncomingEdge in class GraphNode
Throws:
MaltChainedException

addOutgoingEdge

public void addOutgoingEdge(Edge out)
                     throws MaltChainedException
Specified by:
addOutgoingEdge in interface Node
Overrides:
addOutgoingEdge in class GraphNode
Throws:
MaltChainedException

removeOutgoingEdge

public void removeOutgoingEdge(Edge out)
                        throws MaltChainedException
Specified by:
removeOutgoingEdge in interface Node
Overrides:
removeOutgoingEdge in class GraphNode
Throws:
MaltChainedException

setIndex

public void setIndex(int index)
              throws MaltChainedException
Specified by:
setIndex in interface Node
Specified by:
setIndex in class GraphNode
Throws:
MaltChainedException

getIndex

public int getIndex()
Description copied from interface: ComparableNode
Returns the index of the node.

Specified by:
getIndex in interface ComparableNode
Specified by:
getIndex in class GraphNode
Returns:
the index of the node.

getCompareToIndex

public int getCompareToIndex()
Description copied from interface: ComparableNode
Returns the index of the node (only used internal by compareTo).

Specified by:
getCompareToIndex in interface ComparableNode
Returns:
the index of the node (only used internal by compareTo).

isRoot

public boolean isRoot()
Description copied from interface: ComparableNode
Returns true if the node is a root node, otherwise false.

Specified by:
isRoot in interface ComparableNode
Specified by:
isRoot in class GraphNode
Returns:
true if the node is a root node, otherwise false.

getAncestor

public DependencyNode getAncestor()
                           throws MaltChainedException
Specified by:
getAncestor in interface DependencyNode
Throws:
MaltChainedException

getProperAncestor

public DependencyNode getProperAncestor()
                                 throws MaltChainedException
Specified by:
getProperAncestor in interface DependencyNode
Throws:
MaltChainedException

getLeftmostProperDescendant

public ComparableNode getLeftmostProperDescendant()
                                           throws MaltChainedException
Description copied from interface: ComparableNode
Returns the left-most proper terminal descendant node (excluding itself).

Specified by:
getLeftmostProperDescendant in interface ComparableNode
Returns:
the left-most proper terminal descendant node.
Throws:
MaltChainedException

getRightmostProperDescendant

public ComparableNode getRightmostProperDescendant()
                                            throws MaltChainedException
Description copied from interface: ComparableNode
Returns the right-most proper terminal descendant node (excluding itself).

Specified by:
getRightmostProperDescendant in interface ComparableNode
Returns:
the right-most proper terminal descendant node.
Throws:
MaltChainedException

getLeftmostDescendant

public ComparableNode getLeftmostDescendant()
                                     throws MaltChainedException
Description copied from interface: ComparableNode
Returns the left-most terminal descendant node.

Specified by:
getLeftmostDescendant in interface ComparableNode
Returns:
the left-most terminal descendant node.
Throws:
MaltChainedException

getRightmostDescendant

public ComparableNode getRightmostDescendant()
                                      throws MaltChainedException
Description copied from interface: ComparableNode
Returns the right-most terminal descendant node.

Specified by:
getRightmostDescendant in interface ComparableNode
Returns:
the right-most terminal descendant node.
Throws:
MaltChainedException

getParent

public PhraseStructureNode getParent()
Specified by:
getParent in interface PhraseStructureNode

getParentEdge

public Edge getParentEdge()
                   throws MaltChainedException
Specified by:
getParentEdge in interface PhraseStructureNode
Throws:
MaltChainedException

getParentEdgeLabelSymbol

public String getParentEdgeLabelSymbol(SymbolTable table)
                                throws MaltChainedException
Specified by:
getParentEdgeLabelSymbol in interface PhraseStructureNode
Throws:
MaltChainedException

getParentEdgeLabelCode

public int getParentEdgeLabelCode(SymbolTable table)
                           throws MaltChainedException
Specified by:
getParentEdgeLabelCode in interface PhraseStructureNode
Throws:
MaltChainedException

hasParentEdgeLabel

public boolean hasParentEdgeLabel(SymbolTable table)
                           throws MaltChainedException
Specified by:
hasParentEdgeLabel in interface PhraseStructureNode
Throws:
MaltChainedException

hasAtMostOneHead

public boolean hasAtMostOneHead()
Description copied from interface: DependencyNode
Returns true if the node has at most one head, otherwise false.

Specified by:
hasAtMostOneHead in interface DependencyNode
Returns:
true if the node has at most one head, otherwise false.

hasAncestorInside

public boolean hasAncestorInside(int left,
                                 int right)
                          throws MaltChainedException
Specified by:
hasAncestorInside in interface DependencyNode
Throws:
MaltChainedException

getHeadEdges

public Set<Edge> getHeadEdges()
                       throws MaltChainedException
Specified by:
getHeadEdges in interface DependencyNode
Throws:
MaltChainedException

getHeads

public Set<DependencyNode> getHeads()
                             throws MaltChainedException
Specified by:
getHeads in interface DependencyNode
Throws:
MaltChainedException

hasHead

public boolean hasHead()
Description copied from interface: DependencyNode
Returns true if the node has one or more head(s), otherwise false.

Specified by:
hasHead in interface DependencyNode
Returns:
true if the node has one or more head(s), otherwise false.

getHead

public DependencyNode getHead()
                       throws MaltChainedException
Description copied from interface: DependencyNode
Returns the head dependency node if it exists, otherwise null. If there exists more than one head the first head is returned according to the linear order of the terminals or the root if it is one of the heads.

Specified by:
getHead in interface DependencyNode
Returns:
the head dependency node if it exists, otherwise null.
Throws:
MaltChainedException

getHeadEdge

public Edge getHeadEdge()
                 throws MaltChainedException
Description copied from interface: DependencyNode
Returns the edge between the head and the node if it exists, otherwise null. If there exists more than one head edge the first head edge is returned according to the linear order of the terminals or the root if it is one of the heads.

Specified by:
getHeadEdge in interface DependencyNode
Returns:
the edge between the head and the node if it exists, otherwise null.
Throws:
MaltChainedException

addHeadEdgeLabel

public void addHeadEdgeLabel(SymbolTable table,
                             String symbol)
                      throws MaltChainedException
Specified by:
addHeadEdgeLabel in interface DependencyNode
Throws:
MaltChainedException

addHeadEdgeLabel

public void addHeadEdgeLabel(SymbolTable table,
                             int code)
                      throws MaltChainedException
Specified by:
addHeadEdgeLabel in interface DependencyNode
Throws:
MaltChainedException

addHeadEdgeLabel

public void addHeadEdgeLabel(LabelSet labelSet)
                      throws MaltChainedException
Specified by:
addHeadEdgeLabel in interface DependencyNode
Throws:
MaltChainedException

hasHeadEdgeLabel

public boolean hasHeadEdgeLabel(SymbolTable table)
                         throws MaltChainedException
Specified by:
hasHeadEdgeLabel in interface DependencyNode
Throws:
MaltChainedException

getHeadEdgeLabelSymbol

public String getHeadEdgeLabelSymbol(SymbolTable table)
                              throws MaltChainedException
Specified by:
getHeadEdgeLabelSymbol in interface DependencyNode
Throws:
MaltChainedException

getHeadEdgeLabelCode

public int getHeadEdgeLabelCode(SymbolTable table)
                         throws MaltChainedException
Specified by:
getHeadEdgeLabelCode in interface DependencyNode
Throws:
MaltChainedException

isHeadEdgeLabeled

public boolean isHeadEdgeLabeled()
                          throws MaltChainedException
Specified by:
isHeadEdgeLabeled in interface DependencyNode
Throws:
MaltChainedException

nHeadEdgeLabels

public int nHeadEdgeLabels()
                    throws MaltChainedException
Specified by:
nHeadEdgeLabels in interface DependencyNode
Throws:
MaltChainedException

getHeadEdgeLabelTypes

public Set<SymbolTable> getHeadEdgeLabelTypes()
                                       throws MaltChainedException
Specified by:
getHeadEdgeLabelTypes in interface DependencyNode
Throws:
MaltChainedException

getHeadEdgeLabelSet

public LabelSet getHeadEdgeLabelSet()
                             throws MaltChainedException
Specified by:
getHeadEdgeLabelSet in interface DependencyNode
Throws:
MaltChainedException

hasDependent

public boolean hasDependent()
Specified by:
hasDependent in interface DependencyNode

hasLeftDependent

public boolean hasLeftDependent()
Returns true if the node has one or more left dependents, otherwise false.

Specified by:
hasLeftDependent in interface DependencyNode
Returns:
true if the node has one or more left dependents, otherwise false.

getLeftDependent

public DependencyNode getLeftDependent(int index)
Returns the left dependent at the position index, where index==0 equals the left most dependent.

Specified by:
getLeftDependent in interface DependencyNode
Parameters:
index - the index
Returns:
the left dependent at the position index, where index==0 equals the left most dependent

getLeftDependentCount

public int getLeftDependentCount()
Return the number of left dependents

Specified by:
getLeftDependentCount in interface DependencyNode
Returns:
the number of left dependents

getLeftDependents

public SortedSet<DependencyNode> getLeftDependents()
Description copied from interface: DependencyNode
Returns a sorted set of left dependents.

Specified by:
getLeftDependents in interface DependencyNode
Returns:
a sorted set of left dependents.

getLeftSibling

public DependencyNode getLeftSibling()
                              throws MaltChainedException
Returns the left sibling if it exists, otherwise null

Specified by:
getLeftSibling in interface DependencyNode
Returns:
the left sibling if it exists, otherwise null
Throws:
MaltChainedException

getSameSideLeftSibling

public DependencyNode getSameSideLeftSibling()
                                      throws MaltChainedException
Returns the left sibling at the same side of head as the node it self. If not found null
Specified by:
getSameSideLeftSibling in interface DependencyNode
Returns:
the left sibling at the same side of head as the node it self. If not found nullThrows:
MaltChainedException

getClosestLeftDependent

public DependencyNode getClosestLeftDependent()
Returns the closest left dependent to the node it self, if not found null is returned.

Specified by:
getClosestLeftDependent in interface DependencyNode
Returns:
the closest left dependent to the node it self, if not found null is returned.

getLeftmostDependent

public DependencyNode getLeftmostDependent()
Specified by:
getLeftmostDependent in interface DependencyNode

getRightDependent

public DependencyNode getRightDependent(int index)
Specified by:
getRightDependent in interface DependencyNode

getRightDependentCount

public int getRightDependentCount()
Return the number of right dependents

Specified by:
getRightDependentCount in interface DependencyNode
Returns:
the number of right dependents

getRightDependents

public SortedSet<DependencyNode> getRightDependents()
Returns a sorted set of right dependents.

Specified by:
getRightDependents in interface DependencyNode
Returns:
a sorted set of right dependents.

getRightSibling

public DependencyNode getRightSibling()
                               throws MaltChainedException
Returns the right sibling if it exists, otherwise null

Specified by:
getRightSibling in interface DependencyNode
Returns:
the right sibling if it exists, otherwise null
Throws:
MaltChainedException

getSameSideRightSibling

public DependencyNode getSameSideRightSibling()
                                       throws MaltChainedException
Returns the right sibling at the same side of head as the node it self. If not found null
Specified by:
getSameSideRightSibling in interface DependencyNode
Returns:
the right sibling at the same side of head as the node it self. If not found nullThrows:
MaltChainedException

getClosestRightDependent

public DependencyNode getClosestRightDependent()
Returns the closest right dependent to the node it self, if not found null is returned.

Specified by:
getClosestRightDependent in interface DependencyNode
Returns:
the closest right dependent to the node it self, if not found null is returned.

getRightmostDependent

public DependencyNode getRightmostDependent()
Specified by:
getRightmostDependent in interface DependencyNode

getDependencyDominationSet

protected void getDependencyDominationSet(SortedSet<DependencyNode> dominationSet)

hasRightDependent

public boolean hasRightDependent()
Returns true if the node has one or more right dependents, otherwise false.

Specified by:
hasRightDependent in interface DependencyNode
Returns:
true if the node has one or more right dependents, otherwise false.

isProjective

public boolean isProjective()
                     throws MaltChainedException
Description copied from interface: DependencyNode
Returns true if the head edge is projective, otherwise false. Undefined if the node has more than one head.

Specified by:
isProjective in interface DependencyNode
Returns:
true if the head edge is projective, otherwise false.
Throws:
MaltChainedException

getDependencyNodeDepth

public int getDependencyNodeDepth()
                           throws MaltChainedException
Description copied from interface: DependencyNode
Returns the depth of the node. The root node has the depth 0.

Specified by:
getDependencyNodeDepth in interface DependencyNode
Returns:
the depth of the node.
Throws:
MaltChainedException

clear

public void clear()
           throws MaltChainedException
Description copied from class: GraphElement
Resets the graph element.

Specified by:
clear in interface Element
Overrides:
clear in class GraphNode
Throws:
MaltChainedException

compareTo

public int compareTo(ComparableNode that)
Specified by:
compareTo in interface Comparable<ComparableNode>
Overrides:
compareTo in class GraphNode

equals

public boolean equals(Object obj)
Overrides:
equals in class GraphNode

hashCode

public int hashCode()
Overrides:
hashCode in class GraphNode

toString

public String toString()
Overrides:
toString in class GraphNode

MaltParser 1.4.1

Copyright 2007-2010 Johan Hall, Jens Nilsson and Joakim Nivre.