MappablePhraseStructureGraph (MaltParser 1.4.1)
Date: 2010-07-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.4.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.maltparser.core.syntaxgraph
Class MappablePhraseStructureGraph

    java.lang.Object
      org.maltparser.core.syntaxgraph.SyntaxGraph
          org.maltparser.core.syntaxgraph.Sentence
              org.maltparser.core.syntaxgraph.MappablePhraseStructureGraph

All Implemented Interfaces:
  Observer, DependencyStructure, LabeledStructure, PhraseStructure, SecEdgeStructure, Structure, TokenStructure

    public class MappablePhraseStructureGraph

extends Sentence
implements DependencyStructure, PhraseStructure

Author:
  Johan Hall

Field Summary

Fields inherited from class org.maltparser.core.syntaxgraph.Sentence
`sentenceID, terminalNodes, terminalPool`

Fields inherited from class org.maltparser.core.syntaxgraph.SyntaxGraph
`labelSetPool, numberOfComponents, symbolTables`

Constructor Summary
`MappablePhraseStructureGraph(SymbolTableHandler symbolTables)`

Method Summary
`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, String labelFunction, 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()`
`String` | `getDefaultRootEdgeLabelSymbol(SymbolTable table)` Returns the default edge label of the root as a string value.
`SortedSet<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.
`SortedSet<Edge>` | `getEdges()`
`int` | `getHighestDependencyNodeIndex()`
`int` | `getHighestNonTerminalIndex()`
`LosslessMapping` | `getMapping()`
`Set<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, String defaultRootSymbol)` Sets the default edge label of the root.
`void` | `setDefaultRootEdgeLabels(String rootLabelOption, SortedMap<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)`
`String` | `toString()`
`String` | `toStringNonTerminalNode(NonTerminalNode node)`
`String` | `toStringTerminalNode(TokenNode node)`
`void` | `update(Observable o, Object arg)`

Methods inherited from class org.maltparser.core.syntaxgraph.Sentence
`addTokenNode, addTokenNode, getHighestTokenIndex, getOrAddTerminalNode, getSentenceID, getTokenIndices, getTokenNode, hasTokens, nTokenNode, setSentenceID`

Methods inherited from class org.maltparser.core.syntaxgraph.SyntaxGraph
`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.TokenStructure
`addTokenNode, addTokenNode, getHighestTokenIndex, getSentenceID, getTokenIndices, getTokenNode, hasTokens, nTokenNode, setSentenceID`

Methods inherited from interface org.maltparser.core.syntaxgraph.LabeledStructure
`checkInLabelSet, checkOutNewLabelSet, getSymbolTables, setSymbolTables`

Constructor Detail

### MappablePhraseStructureGraph

    public MappablePhraseStructureGraph(SymbolTableHandler symbolTables)
                                 throws MaltChainedException

Throws:
  `MaltChainedException`

Method Detail

### addDependencyNode

    public DependencyNode addDependencyNode()
                                     throws MaltChainedException

  Specified by:
    `addDependencyNode` in interface `DependencyStructure`
  Throws:
    `MaltChainedException`

### addDependencyNode

    public DependencyNode addDependencyNode(int index)
                                     throws MaltChainedException

  Specified by:
    `addDependencyNode` in interface `DependencyStructure`
  Throws:
    `MaltChainedException`

### getDependencyNode

    public DependencyNode getDependencyNode(int index)
                                     throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns the dependency node identified by index if it exists, otherwise null.

  Specified by:
    `getDependencyNode` in interface `DependencyStructure`
  Parameters:
    `index` - the index of the dependency node
  Returns:
    the dependency node identified by index if it exists, otherwise null.
  Throws:
    `MaltChainedException`

### nDependencyNode

    public int nDependencyNode()

  Specified by:
    `nDependencyNode` in interface `DependencyStructure`

### getHighestDependencyNodeIndex

    public int getHighestDependencyNodeIndex()

  Specified by:
    `getHighestDependencyNodeIndex` in interface `DependencyStructure`

### addDependencyEdge

    public Edge addDependencyEdge(int headIndex,
                                  int dependentIndex)
                           throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Adds an edge from the head to the dependent identified by the indices of the dependency nodes.

  Specified by:
    `addDependencyEdge` in interface `DependencyStructure`
  Parameters:
    `headIndex` - the index of the head dependency node
    `dependentIndex` - the index of the dependent dependency node
  Returns:
    the edge that have been added.
  Throws:
    `MaltChainedException`

### addDependencyEdge

    public Edge addDependencyEdge(DependencyNode head,
                                  DependencyNode dependent)
                           throws MaltChainedException

  Throws:
    `MaltChainedException`

### moveDependencyEdge

    public Edge moveDependencyEdge(int newHeadIndex,
                                   int dependentIndex)
                            throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Replace the head of the dependent with a new head. The labels are not affected.

  Specified by:
    `moveDependencyEdge` in interface `DependencyStructure`
  Parameters:
    `newHeadIndex` - the index of the new head dependency node
    `dependentIndex` - the index of the dependent dependency node
  Returns:
    the edge that have been moved.
  Throws:
    `MaltChainedException`

### moveDependencyEdge

    public Edge moveDependencyEdge(DependencyNode newHead,
                                   DependencyNode dependent)
                            throws MaltChainedException

  Throws:
    `MaltChainedException`

### removeDependencyEdge

    public void removeDependencyEdge(int headIndex,
                                     int dependentIndex)
                              throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Remove an edge from the head to the dependent identified by the indices of the dependency nodes.

  Specified by:
    `removeDependencyEdge` in interface `DependencyStructure`
  Parameters:
    `headIndex` - the index of the head dependency node
    `dependentIndex` - the index of the dependent dependency node
  Throws:
    `MaltChainedException`

### removeDependencyEdge

    protected void removeDependencyEdge(Node head,
                                        Node dependent)
                                 throws MaltChainedException

  Throws:
    `MaltChainedException`

### addSecondaryEdge

    public Edge addSecondaryEdge(ComparableNode source,
                                 ComparableNode target)
                          throws MaltChainedException

  Specified by:
    `addSecondaryEdge` in interface `SecEdgeStructure`
  Throws:
    `MaltChainedException`

### removeSecondaryEdge

    public void removeSecondaryEdge(ComparableNode source,
                                    ComparableNode target)
                             throws MaltChainedException

  Specified by:
    `removeSecondaryEdge` in interface `SecEdgeStructure`
  Throws:
    `MaltChainedException`

### hasLabeledDependency

    public boolean hasLabeledDependency(int index)
                                 throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns true if the head edge of the dependency node with index is labeled, otherwise false.

  Specified by:
    `hasLabeledDependency` in interface `DependencyStructure`
  Parameters:
    `index` - the index of the dependency node
  Returns:
    true if the head edge of the dependency node with index is labeled, otherwise false.
  Throws:
    `MaltChainedException`

### isConnected

    public boolean isConnected()

  Description copied from interface: `DependencyStructure`
  Returns true if all nodes in the dependency structure are connected, otherwise false.

  Specified by:
    `isConnected` in interface `DependencyStructure`
  Returns:
    true if all nodes in the dependency structure are connected, otherwise false.

### isProjective

    public boolean isProjective()
                         throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns true if all edges in the dependency structure are projective, otherwise false.

  Specified by:
    `isProjective` in interface `DependencyStructure`
  Returns:
    true if all edges in the dependency structure are projective, otherwise false.
  Throws:
    `MaltChainedException`

### isTree

    public boolean isTree()

  Description copied from interface: `DependencyStructure`
  Returns true if the dependency structure are a tree (isConnected() && isSingleHeaded()), otherwise false.

  Specified by:
    `isTree` in interface `DependencyStructure`
  Returns:
    true if the dependency structure are a tree (isConnected() && isSingleHeaded()), otherwise false.

### isSingleHeaded

    public boolean isSingleHeaded()

  Description copied from interface: `DependencyStructure`
  Returns true if all dependency nodes have at most one incoming edge, otherwise false.

  Specified by:
    `isSingleHeaded` in interface `DependencyStructure`
  Returns:
    true if all dependency nodes have at most one incoming edge, otherwise false.

### isSingleHeadedConstraint

    public boolean isSingleHeadedConstraint()

### setSingleHeadedConstraint

    public void setSingleHeadedConstraint(boolean singleHeadedConstraint)

### nNonProjectiveEdges

    public int nNonProjectiveEdges()
                            throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns the number of non-projective edges in the dependency structure.

  Specified by:
    `nNonProjectiveEdges` in interface `DependencyStructure`
  Returns:
    the number of non-projective edges in the dependency structure.
  Throws:
    `MaltChainedException`

### nEdges

    public int nEdges()

  Description copied from interface: `DependencyStructure`
  Returns the number of edges

  Specified by:
    `nEdges` in interface `DependencyStructure`
  Specified by:
    `nEdges` in interface `PhraseStructure`
  Returns:
    the number of edges

### getEdges

    public SortedSet<Edge> getEdges()

  Specified by:
    `getEdges` in interface `DependencyStructure`

### getDependencyIndices

    public SortedSet<Integer> getDependencyIndices()

  Description copied from interface: `DependencyStructure`
  Returns a sorted set of integers {0,s,..n} , where each index i identifies a dependency node. Index 0 should always be the root dependency node and index s is the first terminal node and index n is the last terminal node.

  Specified by:
    `getDependencyIndices` in interface `DependencyStructure`
  Returns:
    a sorted set of integers

### link

    protected DependencyNode link(DependencyNode x,
                                  DependencyNode y)

### linkAllTerminalsToRoot

    public void linkAllTerminalsToRoot()
                                throws MaltChainedException

  Throws:
    `MaltChainedException`

### linkAllTreesToRoot

    public void linkAllTreesToRoot()
                            throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Links all subtrees to the root of the dependency structure.

  Specified by:
    `linkAllTreesToRoot` in interface `DependencyStructure`
  Throws:
    `MaltChainedException`

### getDefaultRootEdgeLabels

    public LabelSet getDefaultRootEdgeLabels()
                                      throws MaltChainedException

  Specified by:
    `getDefaultRootEdgeLabels` in interface `DependencyStructure`
  Throws:
    `MaltChainedException`

### getDefaultRootEdgeLabelSymbol

    public String getDefaultRootEdgeLabelSymbol(SymbolTable table)
                                         throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns the default edge label of the root as a string value.

  Specified by:
    `getDefaultRootEdgeLabelSymbol` in interface `DependencyStructure`
  Parameters:
    `table` - the symbol table that identifies the label type.
  Returns:
    the default edge label of the root.
  Throws:
    `MaltChainedException`

### getDefaultRootEdgeLabelCode

    public int getDefaultRootEdgeLabelCode(SymbolTable table)
                                    throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Returns the default edge label of the root as an integer value.

  Specified by:
    `getDefaultRootEdgeLabelCode` in interface `DependencyStructure`
  Parameters:
    `table` - the symbol table that identifies the label type.
  Returns:
    the default edge label of the root as an integer value.
  Throws:
    `MaltChainedException`

### setDefaultRootEdgeLabel

    public void setDefaultRootEdgeLabel(SymbolTable table,
                                        String defaultRootSymbol)
                                 throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Sets the default edge label of the root.

  Specified by:
    `setDefaultRootEdgeLabel` in interface `DependencyStructure`
  Parameters:
    `table` - the symbol table that identifies the label type.
    `defaultRootSymbol` - the default root edge label
  Throws:
    `MaltChainedException`

### setDefaultRootEdgeLabels

    public void setDefaultRootEdgeLabels(String rootLabelOption,
                                         SortedMap<String,SymbolTable> edgeSymbolTables)
                                  throws MaltChainedException

  Description copied from interface: `DependencyStructure`
  Sets the default edge label of the root according to the default root label option

  Specified by:
    `setDefaultRootEdgeLabels` in interface `DependencyStructure`
  Parameters:
    `rootLabelOption` - the default root label option
    `edgeSymbolTables` - a sorted map that maps the symbol table name to the symbol table object.
  Throws:
    `MaltChainedException`

### clear

    public void clear()
               throws MaltChainedException

  Description copied from interface: `Structure`
  Resets the structure.

  Specified by:
    `clear` in interface `Structure`
  Overrides:
    `clear` in class `Sentence`
  Throws:
    `MaltChainedException`

### getDependencyRoot

    public DependencyNode getDependencyRoot()

  Description copied from interface: `DependencyStructure`
  Returns the root of the dependency structure.

  Specified by:
    `getDependencyRoot` in interface `DependencyStructure`
  Returns:
    the root of the dependency structure.

### addTerminalNode

    public PhraseStructureNode addTerminalNode()
                                        throws MaltChainedException

  Specified by:
    `addTerminalNode` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### addTerminalNode

    public PhraseStructureNode addTerminalNode(int index)
                                        throws MaltChainedException

  Specified by:
    `addTerminalNode` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### getTerminalNode

    public PhraseStructureNode getTerminalNode(int index)

  Specified by:
    `getTerminalNode` in interface `PhraseStructure`

### nTerminalNode

    public int nTerminalNode()

  Specified by:
    `nTerminalNode` in interface `PhraseStructure`

### addNonTerminalNode

    public PhraseStructureNode addNonTerminalNode(int index)
                                           throws MaltChainedException

  Specified by:
    `addNonTerminalNode` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### addNonTerminalNode

    public PhraseStructureNode addNonTerminalNode()
                                           throws MaltChainedException

  Specified by:
    `addNonTerminalNode` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### getNonTerminalNode

    public PhraseStructureNode getNonTerminalNode(int index)
                                           throws MaltChainedException

  Specified by:
    `getNonTerminalNode` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### getHighestNonTerminalIndex

    public int getHighestNonTerminalIndex()

  Specified by:
    `getHighestNonTerminalIndex` in interface `PhraseStructure`

### getNonTerminalIndices

    public Set<Integer> getNonTerminalIndices()

  Specified by:
    `getNonTerminalIndices` in interface `PhraseStructure`

### hasNonTerminals

    public boolean hasNonTerminals()

  Specified by:
    `hasNonTerminals` in interface `PhraseStructure`

### nNonTerminals

    public int nNonTerminals()

  Specified by:
    `nNonTerminals` in interface `PhraseStructure`

### getPhraseStructureRoot

    public PhraseStructureNode getPhraseStructureRoot()

  Specified by:
    `getPhraseStructureRoot` in interface `PhraseStructure`

### addPhraseStructureEdge

    public Edge addPhraseStructureEdge(PhraseStructureNode parent,
                                       PhraseStructureNode child)
                                throws MaltChainedException

  Specified by:
    `addPhraseStructureEdge` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### update

    public void update(Observable o,
                       Object arg)

  Specified by:
    `update` in interface `Observer`
  Overrides:
    `update` in class `Sentence`

### getMapping

    public LosslessMapping getMapping()

### setMapping

    public void setMapping(LosslessMapping mapping)

### addLabel

    public void addLabel(Element element,
                         String labelFunction,
                         String label)
                  throws MaltChainedException

  Description copied from interface: `LabeledStructure`
  Adds a label label to the graph element element

  Specified by:
    `addLabel` in interface `LabeledStructure`
  Overrides:
    `addLabel` in class `SyntaxGraph`
  Parameters:
    `element` - a graph element element (a node or a edge).
    `labelFunction` - the name of the symbol table.
    `label` - the string value of the label.
  Throws:
    `MaltChainedException`

### removePhraseStructureEdge

    public void removePhraseStructureEdge(PhraseStructureNode parent,
                                          PhraseStructureNode child)
                                   throws MaltChainedException

  Specified by:
    `removePhraseStructureEdge` in interface `PhraseStructure`
  Throws:
    `MaltChainedException`

### isContinuous

    public boolean isContinuous()

  Specified by:
    `isContinuous` in interface `PhraseStructure`

### isContinuousExcludeTerminalsAttachToRoot

    public boolean isContinuousExcludeTerminalsAttachToRoot()

  Specified by:
    `isContinuousExcludeTerminalsAttachToRoot` in interface `PhraseStructure`

### toStringTerminalNode

    public String toStringTerminalNode(TokenNode node)

### toStringNonTerminalNode

    public String toStringNonTerminalNode(NonTerminalNode node)

### toString

    public String toString()

  Overrides:
    `toString` in class `Sentence`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.4.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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