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, setSymbolTablesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLabel, checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTablesprotected final ObjectPoolList<Token> terminalPool
protected final java.util.SortedMap<java.lang.Integer,Token> terminalNodes
protected int sentenceID
public Sentence(SymbolTableHandler symbolTables) throws MaltChainedException
MaltChainedExceptionpublic TokenNode addTokenNode(int index) throws MaltChainedException
TokenStructureaddTokenNode in interface TokenStructureindex - the index of the token node.MaltChainedExceptionpublic TokenNode addTokenNode() throws MaltChainedException
TokenStructureaddTokenNode in interface TokenStructureMaltChainedExceptionpublic void addComment(java.lang.String comment, int at_index)
addComment in interface TokenStructurepublic java.util.ArrayList<java.lang.String> getComment(int at_index)
getComment in interface TokenStructurepublic boolean hasComments()
hasComments in interface TokenStructurepublic int nTokenNode()
TokenStructurenTokenNode in interface TokenStructurepublic boolean hasTokens()
TokenStructurehasTokens in interface TokenStructureprotected Token getOrAddTerminalNode(int index) throws MaltChainedException
MaltChainedExceptionpublic java.util.SortedSet<java.lang.Integer> getTokenIndices()
TokenStructuregetTokenIndices in interface TokenStructurepublic int getHighestTokenIndex()
TokenStructuregetHighestTokenIndex in interface TokenStructurepublic TokenNode getTokenNode(int index)
TokenStructuregetTokenNode in interface TokenStructureindex - the index of the token node.public int getSentenceID()
TokenStructuregetSentenceID in interface TokenStructurepublic void setSentenceID(int sentenceID)
TokenStructuresetSentenceID in interface TokenStructuresentenceID - a sentence IDpublic void clear() throws MaltChainedException
LabeledStructureclear in interface LabeledStructureclear in class SyntaxGraphMaltChainedExceptionpublic void update(java.util.Observable o, java.lang.Object str)
update in interface java.util.Observerpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.