public class MappablePhraseStructureGraph extends Sentence implements DependencyStructure, PhraseStructure
comments, sentenceID, terminalNodes, terminalPoollabelSetPool, numberOfComponents, symbolTables| Constructor and Description |
|---|
MappablePhraseStructureGraph(SymbolTableHandler symbolTables) |
| Modifier and Type | Method and Description |
|---|---|
Edge |
addDependencyEdge(DependencyNode head,
DependencyNode dependent) |
Edge |
addDependencyEdge(int headIndex,
int dependentIndex)
Adds an edge from the head to the dependent identified by the indices of the dependency nodes.
|
DependencyNode |
addDependencyNode() |
DependencyNode |
addDependencyNode(int index) |
void |
addLabel(Element element,
java.lang.String labelFunction,
java.lang.String label)
Adds a label label to the graph element element
|
PhraseStructureNode |
addNonTerminalNode() |
PhraseStructureNode |
addNonTerminalNode(int index) |
Edge |
addPhraseStructureEdge(PhraseStructureNode parent,
PhraseStructureNode child) |
Edge |
addSecondaryEdge(ComparableNode source,
ComparableNode target) |
PhraseStructureNode |
addTerminalNode() |
PhraseStructureNode |
addTerminalNode(int index) |
void |
clear()
Resets the structure.
|
int |
getDefaultRootEdgeLabelCode(SymbolTable table)
Returns the default edge label of the root as an integer value.
|
LabelSet |
getDefaultRootEdgeLabels() |
java.lang.String |
getDefaultRootEdgeLabelSymbol(SymbolTable table)
Returns the default edge label of the root as a string value.
|
java.util.SortedSet<java.lang.Integer> |
getDependencyIndices()
Returns a sorted set of integers {0,s,..n} , where each index i identifies a dependency node.
|
DependencyNode |
getDependencyNode(int index)
Returns the dependency node identified by index if it exists, otherwise null.
|
DependencyNode |
getDependencyRoot()
Returns the root of the dependency structure.
|
java.util.SortedSet<Edge> |
getEdges() |
int |
getHighestDependencyNodeIndex() |
int |
getHighestNonTerminalIndex() |
LosslessMapping |
getMapping() |
java.util.Set<java.lang.Integer> |
getNonTerminalIndices() |
PhraseStructureNode |
getNonTerminalNode(int index) |
PhraseStructureNode |
getPhraseStructureRoot() |
PhraseStructureNode |
getTerminalNode(int index) |
boolean |
hasLabeledDependency(int index)
Returns true if the head edge of the dependency node with index is labeled, otherwise false.
|
boolean |
hasNonTerminals() |
boolean |
isConnected()
Returns true if all nodes in the dependency structure are connected, otherwise false.
|
boolean |
isContinuous() |
boolean |
isContinuousExcludeTerminalsAttachToRoot() |
boolean |
isProjective()
Returns true if all edges in the dependency structure are projective, otherwise false.
|
boolean |
isSingleHeaded()
Returns true if all dependency nodes have at most one incoming edge, otherwise false.
|
boolean |
isSingleHeadedConstraint() |
boolean |
isTree()
Returns true if the dependency structure are a tree (isConnected() && isSingleHeaded()), otherwise false.
|
protected DependencyNode |
link(DependencyNode x,
DependencyNode y) |
void |
linkAllTerminalsToRoot() |
void |
linkAllTreesToRoot()
Links all subtrees to the root of the dependency structure.
|
Edge |
moveDependencyEdge(DependencyNode newHead,
DependencyNode dependent) |
Edge |
moveDependencyEdge(int newHeadIndex,
int dependentIndex)
Replace the head of the dependent with a new head.
|
int |
nDependencyNode() |
int |
nEdges()
Returns the number of edges
|
int |
nNonProjectiveEdges()
Returns the number of non-projective edges in the dependency structure.
|
int |
nNonTerminals() |
int |
nTerminalNode() |
void |
removeDependencyEdge(int headIndex,
int dependentIndex)
Remove an edge from the head to the dependent identified by the indices of the dependency nodes.
|
protected void |
removeDependencyEdge(Node head,
Node dependent) |
void |
removePhraseStructureEdge(PhraseStructureNode parent,
PhraseStructureNode child) |
void |
removeSecondaryEdge(ComparableNode source,
ComparableNode target) |
void |
setDefaultRootEdgeLabel(SymbolTable table,
java.lang.String defaultRootSymbol)
Sets the default edge label of the root.
|
void |
setDefaultRootEdgeLabels(java.lang.String rootLabelOption,
java.util.SortedMap<java.lang.String,SymbolTable> edgeSymbolTables)
Sets the default edge label of the root according to the default root label option
|
void |
setMapping(LosslessMapping mapping) |
void |
setSingleHeadedConstraint(boolean singleHeadedConstraint) |
java.lang.String |
toString() |
java.lang.String |
toStringNonTerminalNode(NonTerminalNode node) |
java.lang.String |
toStringTerminalNode(TokenNode node) |
void |
update(java.util.Observable o,
java.lang.Object arg) |
addComment, addTokenNode, addTokenNode, getComment, getHighestTokenIndex, getOrAddTerminalNode, getSentenceID, getTokenIndices, getTokenNode, hasComments, hasTokens, nTokenNode, setSentenceIDcheckInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTablesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddComment, addTokenNode, addTokenNode, getComment, getHighestTokenIndex, getSentenceID, getTokenIndices, getTokenNode, hasComments, hasTokens, nTokenNode, setSentenceIDcheckInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTablespublic MappablePhraseStructureGraph(SymbolTableHandler symbolTables) throws MaltChainedException
MaltChainedExceptionpublic DependencyNode addDependencyNode() throws MaltChainedException
addDependencyNode in interface DependencyStructureMaltChainedExceptionpublic DependencyNode addDependencyNode(int index) throws MaltChainedException
addDependencyNode in interface DependencyStructureMaltChainedExceptionpublic DependencyNode getDependencyNode(int index) throws MaltChainedException
DependencyStructuregetDependencyNode in interface DependencyStructureindex - the index of the dependency nodeMaltChainedExceptionpublic int nDependencyNode()
nDependencyNode in interface DependencyStructurepublic int getHighestDependencyNodeIndex()
getHighestDependencyNodeIndex in interface DependencyStructurepublic Edge addDependencyEdge(int headIndex, int dependentIndex) throws MaltChainedException
DependencyStructureaddDependencyEdge in interface DependencyStructureheadIndex - the index of the head dependency nodedependentIndex - the index of the dependent dependency nodeMaltChainedExceptionpublic Edge addDependencyEdge(DependencyNode head, DependencyNode dependent) throws MaltChainedException
MaltChainedExceptionpublic Edge moveDependencyEdge(int newHeadIndex, int dependentIndex) throws MaltChainedException
DependencyStructuremoveDependencyEdge in interface DependencyStructurenewHeadIndex - the index of the new head dependency nodedependentIndex - the index of the dependent dependency nodeMaltChainedExceptionpublic Edge moveDependencyEdge(DependencyNode newHead, DependencyNode dependent) throws MaltChainedException
MaltChainedExceptionpublic void removeDependencyEdge(int headIndex, int dependentIndex) throws MaltChainedException
DependencyStructureremoveDependencyEdge in interface DependencyStructureheadIndex - the index of the head dependency nodedependentIndex - the index of the dependent dependency nodeMaltChainedExceptionprotected void removeDependencyEdge(Node head, Node dependent) throws MaltChainedException
MaltChainedExceptionpublic Edge addSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException
addSecondaryEdge in interface SecEdgeStructureMaltChainedExceptionpublic void removeSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException
removeSecondaryEdge in interface SecEdgeStructureMaltChainedExceptionpublic boolean hasLabeledDependency(int index) throws MaltChainedException
DependencyStructurehasLabeledDependency in interface DependencyStructureindex - the index of the dependency nodeMaltChainedExceptionpublic boolean isConnected()
DependencyStructureisConnected in interface DependencyStructurepublic boolean isProjective() throws MaltChainedException
DependencyStructureisProjective in interface DependencyStructureMaltChainedExceptionpublic boolean isTree()
DependencyStructureisTree in interface DependencyStructurepublic boolean isSingleHeaded()
DependencyStructureisSingleHeaded in interface DependencyStructurepublic boolean isSingleHeadedConstraint()
public void setSingleHeadedConstraint(boolean singleHeadedConstraint)
public int nNonProjectiveEdges() throws MaltChainedException
DependencyStructurenNonProjectiveEdges in interface DependencyStructureMaltChainedExceptionpublic int nEdges()
DependencyStructurenEdges in interface DependencyStructurenEdges in interface PhraseStructurepublic java.util.SortedSet<Edge> getEdges()
getEdges in interface DependencyStructurepublic java.util.SortedSet<java.lang.Integer> getDependencyIndices()
DependencyStructuregetDependencyIndices in interface DependencyStructureprotected DependencyNode link(DependencyNode x, DependencyNode y) throws MaltChainedException
MaltChainedExceptionpublic void linkAllTerminalsToRoot() throws MaltChainedException
MaltChainedExceptionpublic void linkAllTreesToRoot() throws MaltChainedException
DependencyStructurelinkAllTreesToRoot in interface DependencyStructureMaltChainedExceptionpublic LabelSet getDefaultRootEdgeLabels() throws MaltChainedException
getDefaultRootEdgeLabels in interface DependencyStructureMaltChainedExceptionpublic java.lang.String getDefaultRootEdgeLabelSymbol(SymbolTable table) throws MaltChainedException
DependencyStructuregetDefaultRootEdgeLabelSymbol in interface DependencyStructuretable - the symbol table that identifies the label type.MaltChainedExceptionpublic int getDefaultRootEdgeLabelCode(SymbolTable table) throws MaltChainedException
DependencyStructuregetDefaultRootEdgeLabelCode in interface DependencyStructuretable - the symbol table that identifies the label type.MaltChainedExceptionpublic void setDefaultRootEdgeLabel(SymbolTable table, java.lang.String defaultRootSymbol) throws MaltChainedException
DependencyStructuresetDefaultRootEdgeLabel in interface DependencyStructuretable - the symbol table that identifies the label type.defaultRootSymbol - the default root edge labelMaltChainedExceptionpublic void setDefaultRootEdgeLabels(java.lang.String rootLabelOption, java.util.SortedMap<java.lang.String,SymbolTable> edgeSymbolTables) throws MaltChainedException
DependencyStructuresetDefaultRootEdgeLabels in interface DependencyStructurerootLabelOption - the default root label optionedgeSymbolTables - a sorted map that maps the symbol table name to the symbol table object.MaltChainedExceptionpublic void clear() throws MaltChainedException
LabeledStructureclear in interface LabeledStructureclear in class SentenceMaltChainedExceptionpublic DependencyNode getDependencyRoot()
DependencyStructuregetDependencyRoot in interface DependencyStructurepublic PhraseStructureNode addTerminalNode() throws MaltChainedException
addTerminalNode in interface PhraseStructureMaltChainedExceptionpublic PhraseStructureNode addTerminalNode(int index) throws MaltChainedException
addTerminalNode in interface PhraseStructureMaltChainedExceptionpublic PhraseStructureNode getTerminalNode(int index)
getTerminalNode in interface PhraseStructurepublic int nTerminalNode()
nTerminalNode in interface PhraseStructurepublic PhraseStructureNode addNonTerminalNode(int index) throws MaltChainedException
addNonTerminalNode in interface PhraseStructureMaltChainedExceptionpublic PhraseStructureNode addNonTerminalNode() throws MaltChainedException
addNonTerminalNode in interface PhraseStructureMaltChainedExceptionpublic PhraseStructureNode getNonTerminalNode(int index) throws MaltChainedException
getNonTerminalNode in interface PhraseStructureMaltChainedExceptionpublic int getHighestNonTerminalIndex()
getHighestNonTerminalIndex in interface PhraseStructurepublic java.util.Set<java.lang.Integer> getNonTerminalIndices()
getNonTerminalIndices in interface PhraseStructurepublic boolean hasNonTerminals()
hasNonTerminals in interface PhraseStructurepublic int nNonTerminals()
nNonTerminals in interface PhraseStructurepublic PhraseStructureNode getPhraseStructureRoot()
getPhraseStructureRoot in interface PhraseStructurepublic Edge addPhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException
addPhraseStructureEdge in interface PhraseStructureMaltChainedExceptionpublic void update(java.util.Observable o, java.lang.Object arg)
public LosslessMapping getMapping()
public void setMapping(LosslessMapping mapping)
public void addLabel(Element element, java.lang.String labelFunction, java.lang.String label) throws MaltChainedException
LabeledStructureaddLabel in interface LabeledStructureaddLabel in class SyntaxGraphelement - a graph element element (a node or a edge).labelFunction - the name of the symbol table.label - the string value of the label.MaltChainedExceptionpublic void removePhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException
removePhraseStructureEdge in interface PhraseStructureMaltChainedExceptionpublic boolean isContinuous()
isContinuous in interface PhraseStructurepublic boolean isContinuousExcludeTerminalsAttachToRoot()
isContinuousExcludeTerminalsAttachToRoot in interface PhraseStructurepublic java.lang.String toStringTerminalNode(TokenNode node)
public java.lang.String toStringNonTerminalNode(NonTerminalNode node)
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.