public class Sentence extends SyntaxGraph implements TokenStructure
Modifier and Type | Field and Description |
---|---|
protected HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> |
comments |
protected int |
sentenceID |
protected java.util.SortedMap<java.lang.Integer,Token> |
terminalNodes |
protected ObjectPoolList<Token> |
terminalPool |
labelSetPool, numberOfComponents, symbolTables
Constructor and Description |
---|
Sentence(SymbolTableHandler symbolTables) |
Modifier and Type | Method and Description |
---|---|
void |
addComment(java.lang.String comment,
int at_index) |
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.
|
java.util.ArrayList<java.lang.String> |
getComment(int at_index) |
int |
getHighestTokenIndex()
Returns the index of the last token node.
|
protected Token |
getOrAddTerminalNode(int index) |
int |
getSentenceID()
Returns the sentence ID
|
java.util.SortedSet<java.lang.Integer> |
getTokenIndices()
Returns a sorted set of integers {s,...
|
TokenNode |
getTokenNode(int index)
Returns the token node with index index.
|
boolean |
hasComments() |
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
|
java.lang.String |
toString() |
void |
update(java.util.Observable o,
java.lang.Object str) |
addLabel, checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTables
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLabel, checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTables
protected final ObjectPoolList<Token> terminalPool
protected final java.util.SortedMap<java.lang.Integer,Token> terminalNodes
protected int sentenceID
public Sentence(SymbolTableHandler symbolTables) throws MaltChainedException
MaltChainedException
public TokenNode addTokenNode(int index) throws MaltChainedException
TokenStructure
addTokenNode
in interface TokenStructure
index
- the index of the token node.MaltChainedException
public TokenNode addTokenNode() throws MaltChainedException
TokenStructure
addTokenNode
in interface TokenStructure
MaltChainedException
public void addComment(java.lang.String comment, int at_index)
addComment
in interface TokenStructure
public java.util.ArrayList<java.lang.String> getComment(int at_index)
getComment
in interface TokenStructure
public boolean hasComments()
hasComments
in interface TokenStructure
public int nTokenNode()
TokenStructure
nTokenNode
in interface TokenStructure
public boolean hasTokens()
TokenStructure
hasTokens
in interface TokenStructure
protected Token getOrAddTerminalNode(int index) throws MaltChainedException
MaltChainedException
public java.util.SortedSet<java.lang.Integer> getTokenIndices()
TokenStructure
getTokenIndices
in interface TokenStructure
public int getHighestTokenIndex()
TokenStructure
getHighestTokenIndex
in interface TokenStructure
public TokenNode getTokenNode(int index)
TokenStructure
getTokenNode
in interface TokenStructure
index
- the index of the token node.public int getSentenceID()
TokenStructure
getSentenceID
in interface TokenStructure
public void setSentenceID(int sentenceID)
TokenStructure
setSentenceID
in interface TokenStructure
sentenceID
- a sentence IDpublic void clear() throws MaltChainedException
LabeledStructure
clear
in interface LabeledStructure
clear
in class SyntaxGraph
MaltChainedException
public void update(java.util.Observable o, java.lang.Object str)
update
in interface java.util.Observer
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.