se.lth.cs.nlp.nlputils.pstree
Class TokenNode

java.lang.Object
  extended by se.lth.cs.nlp.nlputils.pstree.Node
      extended by se.lth.cs.nlp.nlputils.pstree.TokenNode

public class TokenNode
extends Node

A terminal node in a phrase structure tree.


Field Summary
 String lemma
          The lemma, if available.
 String pos
          The part of speech.
 int position
          The position in the sentence.
(package private)  Node subtree
           
 String word
          The word.
 
Fields inherited from class se.lth.cs.nlp.nlputils.pstree.Node
parent
 
Constructor Summary
TokenNode()
           
 
Method Summary
 TokenNode depParent()
          The dependency parent of this token node.
 TokenNode getFirstToken()
          Returns the leftmost dependent token.
 TokenNode getHead()
          Returns the head token node.
 String getLabel()
          For a token node, returns the part of speech; for a nonterminal node, returns its label.
 TokenNode getLastToken()
          Returns the rightmost dependent token.
 boolean isPunctuation()
          Returns true if this is a punctuation token.
 boolean isSameOrAncestorOf(Node n)
          Returns true if this node is identical to or is an ancestor of n.
 Pair<Integer,Integer> span()
          Returns the span of the node, that is the index of the leftmost dependent token and the index of the rightmost dependent token + 1.
 String toString()
           
 
Methods inherited from class se.lth.cs.nlp.nlputils.pstree.Node
overlaps, setHeads, setHeadsSwedish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

word

public String word
The word.


pos

public String pos
The part of speech.


lemma

public String lemma
The lemma, if available.


position

public int position
The position in the sentence.


subtree

Node subtree
Constructor Detail

TokenNode

public TokenNode()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

span

public Pair<Integer,Integer> span()
Description copied from class: Node
Returns the span of the node, that is the index of the leftmost dependent token and the index of the rightmost dependent token + 1.

Specified by:
span in class Node
Returns:
the span of the node.

isSameOrAncestorOf

public boolean isSameOrAncestorOf(Node n)
Description copied from class: Node
Returns true if this node is identical to or is an ancestor of n.

Specified by:
isSameOrAncestorOf in class Node
Parameters:
n - the node.
Returns:
true if this node is identical to or is an ancestor of n.

depParent

public TokenNode depParent()
The dependency parent of this token node.

Returns:
the dependency parent of this token node.

getLabel

public String getLabel()
Description copied from class: Node
For a token node, returns the part of speech; for a nonterminal node, returns its label.

Specified by:
getLabel in class Node
Returns:
the label.

getHead

public TokenNode getHead()
Description copied from class: Node
Returns the head token node.

Specified by:
getHead in class Node
Returns:
the head token node.

getLastToken

public TokenNode getLastToken()
Description copied from class: Node
Returns the rightmost dependent token.

Specified by:
getLastToken in class Node
Returns:
the rightmost dependent token.

getFirstToken

public TokenNode getFirstToken()
Description copied from class: Node
Returns the leftmost dependent token.

Specified by:
getFirstToken in class Node
Returns:
the rightmost dependent token.

isPunctuation

public boolean isPunctuation()
Returns true if this is a punctuation token.

Returns:
true if this is a punctuation token.