Package org.maltparserx.core.syntaxgraph

Examples of org.maltparserx.core.syntaxgraph.DependencyGraph


 
  public StackConfig(SymbolTableHandler symbolTableHandler) throws MaltChainedException {
    super();
    stack = new Stack<DependencyNode>();
    input = new Stack<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
  }
View Full Code Here


 
  public CovingtonConfig(SymbolTableHandler symbolTableHandler, boolean cr, boolean cs) throws MaltChainedException {
    super();
    input = new ArrayList<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
    setAllowRoot(cr);
    setAllowShift(cs);
  }
View Full Code Here

 
  public NivreConfig(SymbolTableHandler symbolTableHandler, boolean allowRoot, boolean allowReduce) throws MaltChainedException {
    super();
    stack = new Stack<DependencyNode>();
    input = new Stack<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
    setAllowRoot(allowRoot);
    setAllowReduce(allowReduce);
  }
View Full Code Here

 
  public PlanarConfig(SymbolTableHandler symbolTableHandler, String noCoveredRoots , String acyclicity , String connectedness , String rootHandling ) throws MaltChainedException {
    super();
    stack = new Stack<DependencyNode>();
    input = new Stack<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
    setRootHandling(rootHandling);
    setNoCoveredRoots(Boolean.valueOf(noCoveredRoots));
    setAcyclicity(Boolean.valueOf(acyclicity));
    setConnectedness(connectedness);
  }
View Full Code Here

    super();
    firstStack = new Stack<DependencyNode>();
    secondStack = new Stack<DependencyNode>();
    activeStack = FIRST_STACK;
    input = new Stack<DependencyNode>();
    dependencyGraph = new DependencyGraph(symbolTableHandler);
    setRootHandling(rootHandling);
    setNoCoveredRoots(Boolean.valueOf(noCoveredRoots));
    setAcyclicity(Boolean.valueOf(acyclicity));
    setReduceAfterSwitch(Boolean.valueOf(reduceAfterSwitch));
  }
View Full Code Here

    }
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to parse. ");
    }

    DependencyStructure outputGraph = new DependencyGraph(singleMalt.getSymbolTables());
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    // Invoke parse with the output graph
    singleMalt.parse(outputGraph);
    return outputGraph;
  }
View Full Code Here

      throw new MaltChainedException("No parser model has been initialized. Please use the method initializeParserModel() before invoking this method.");
    }
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to convert. ");
    }
    DependencyStructure outputGraph = new DependencyGraph(singleMalt.getSymbolTables());
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      Edge edge = null;
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          } else if (column.getCategory() == ColumnDescription.HEAD) {
            if (column.getCategory() != ColumnDescription.IGNORE && !items[j].equals("_")) {
              edge = ((DependencyStructure)outputGraph).addDependencyEdge(Integer.parseInt(items[j]), i+1);
            }
          } else if (column.getCategory() == ColumnDescription.DEPENDENCY_EDGE_LABEL && edge != null) {
            outputGraph.addLabel(edge, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    return outputGraph;
  }
View Full Code Here

    // Creates a dependency graph
    if (tokens == null || tokens.length == 0) {
      throw new MaltChainedException("Nothing to convert. ");
    }
    DependencyStructure outputGraph = new DependencyGraph(symbolTables);
   
    for (int i = 0; i < tokens.length; i++) {
      Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
      DependencyNode node = outputGraph.addDependencyNode(i+1);
      String[] items = tokens[i].split("\t");
      Edge edge = null;
      for (int j = 0; j < items.length; j++) {
        if (columns.hasNext()) {
          ColumnDescription column = columns.next();
          if (column.getCategory() == ColumnDescription.INPUT && node != null) {
            outputGraph.addLabel(node, column.getName(), items[j]);
          } else if (column.getCategory() == ColumnDescription.HEAD) {
            if (column.getCategory() != ColumnDescription.IGNORE && !items[j].equals("_")) {
              edge = ((DependencyStructure)outputGraph).addDependencyEdge(Integer.parseInt(items[j]), i+1);
            }
          } else if (column.getCategory() == ColumnDescription.DEPENDENCY_EDGE_LABEL && edge != null) {
            outputGraph.addLabel(edge, column.getName(), items[j]);
          }
        }
      }
    }
    outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
    return outputGraph;
  }
View Full Code Here

TOP

Related Classes of org.maltparserx.core.syntaxgraph.DependencyGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.