MaltParser 1.4.1

org.maltparser.core.syntaxgraph
Class Sentence

java.lang.Object
  extended by org.maltparser.core.syntaxgraph.SyntaxGraph
      extended by org.maltparser.core.syntaxgraph.Sentence
All Implemented Interfaces:
Observer, LabeledStructure, Structure, TokenStructure
Direct Known Subclasses:
DependencyGraph, MappablePhraseStructureGraph, PhraseStructureGraph

public class Sentence
extends SyntaxGraph
implements TokenStructure

Author:
Johan Hall

Field Summary
protected  int sentenceID
           
protected  SortedMap<Integer,Token> terminalNodes
           
protected  ObjectPoolList<Token> terminalPool
           
 
Fields inherited from class org.maltparser.core.syntaxgraph.SyntaxGraph
labelSetPool, numberOfComponents, symbolTables
 
Constructor Summary
Sentence(SymbolTableHandler symbolTables)
           
 
Method Summary
 TokenNode addTokenNode()
          Adds a token node with index n + 1, where n is the index of the last token node.
 TokenNode addTokenNode(int index)
          Adds a token node with index index.
 void clear()
          Resets the structure.
 int getHighestTokenIndex()
          Returns the index of the last token node.
protected  Token getOrAddTerminalNode(int index)
           
 int getSentenceID()
          Returns the sentence ID
 SortedSet<Integer> getTokenIndices()
          Returns a sorted set of integers {s,...
 TokenNode getTokenNode(int index)
          Returns the token node with index index.
 boolean hasTokens()
          Returns true if the token structure (sentence) has any token nodes, otherwise false.
 int nTokenNode()
          Returns the number of token nodes in the token structure (sentence).
 void setSentenceID(int sentenceID)
          Sets the sentence ID
 String toString()
           
 void update(Observable o, Object str)
           
 
Methods inherited from class org.maltparser.core.syntaxgraph.SyntaxGraph
addLabel, checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.maltparser.core.syntaxgraph.LabeledStructure
addLabel, checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTables
 

Field Detail

terminalPool

protected final ObjectPoolList<Token> terminalPool

terminalNodes

protected final SortedMap<Integer,Token> terminalNodes

sentenceID

protected int sentenceID
Constructor Detail

Sentence

public Sentence(SymbolTableHandler symbolTables)
         throws MaltChainedException
Throws:
MaltChainedException
Method Detail

addTokenNode

public TokenNode addTokenNode(int index)
                       throws MaltChainedException
Description copied from interface: TokenStructure
Adds a token node with index index.

Specified by:
addTokenNode in interface TokenStructure
Parameters:
index - the index of the token node.
Returns:
the added token node.
Throws:
MaltChainedException

addTokenNode

public TokenNode addTokenNode()
                       throws MaltChainedException
Description copied from interface: TokenStructure
Adds a token node with index n + 1, where n is the index of the last token node.

Specified by:
addTokenNode in interface TokenStructure
Returns:
the added token node.
Throws:
MaltChainedException

nTokenNode

public int nTokenNode()
Description copied from interface: TokenStructure
Returns the number of token nodes in the token structure (sentence).

Specified by:
nTokenNode in interface TokenStructure
Returns:
the number of token nodes in the token structure (sentence).

hasTokens

public boolean hasTokens()
Description copied from interface: TokenStructure
Returns true if the token structure (sentence) has any token nodes, otherwise false.

Specified by:
hasTokens in interface TokenStructure
Returns:
true if the token structure (sentence) has any token nodes, otherwise false.

getOrAddTerminalNode

protected Token getOrAddTerminalNode(int index)
                              throws MaltChainedException
Throws:
MaltChainedException

getTokenIndices

public SortedSet<Integer> getTokenIndices()
Description copied from interface: TokenStructure
Returns a sorted set of integers {s,...,n}, where each index i identifies a token node. Index s is the first token node and index n is the last token node.

Specified by:
getTokenIndices in interface TokenStructure
Returns:
a sorted set of integers {s,...,n}.

getHighestTokenIndex

public int getHighestTokenIndex()
Description copied from interface: TokenStructure
Returns the index of the last token node.

Specified by:
getHighestTokenIndex in interface TokenStructure
Returns:
the index of the last token node.

getTokenNode

public TokenNode getTokenNode(int index)
Description copied from interface: TokenStructure
Returns the token node with index index.

Specified by:
getTokenNode in interface TokenStructure
Parameters:
index - the index of the token node.
Returns:
a token node with index index.

getSentenceID

public int getSentenceID()
Description copied from interface: TokenStructure
Returns the sentence ID

Specified by:
getSentenceID in interface TokenStructure
Returns:
the sentence ID

setSentenceID

public void setSentenceID(int sentenceID)
Description copied from interface: TokenStructure
Sets the sentence ID

Specified by:
setSentenceID in interface TokenStructure
Parameters:
sentenceID - a sentence ID

clear

public void clear()
           throws MaltChainedException
Description copied from interface: Structure
Resets the structure.

Specified by:
clear in interface Structure
Overrides:
clear in class SyntaxGraph
Throws:
MaltChainedException

update

public void update(Observable o,
                   Object str)
Specified by:
update in interface Observer

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.4.1

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